【Project Euler】9 第九题

简介:


A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,

a2 + b2 = c2

For example, 32 + 42 = 9 + 16 = 25 = 52.

There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.


static void Main(string[] args)
        {
            for (int i = 1; i < 1000; i++)
            {
                for (int j = 1; j < 1000; j++)
                {
                    for (int k = 1; k < 1000; k++)
                    {
                        if (i + j + k == 1000)
                        {
                            if (j * j + k * k == i * i)
                            {
                                int x = i * j * k;
                                Console.WriteLine(x);
                            }
                        }
                    }
                }
            }
        }

目录
相关文章
|
8月前
|
Apache 调度 数据库
Apache DolphinScheduler VS WhaleScheduler
Apache DolphinScheduler VS WhaleScheduler
756 59
|
8月前
|
Java 测试技术 Maven
Default (Build) 生命周期
Maven的Default(Build)生命周期包括23个阶段,从validate到deploy,涉及源码编译、资源处理、测试、打包和部署等步骤。命令如`mvn compile`只会执行及之前的所有阶段。不同目标与生命周期阶段绑定,适应JAR、WAR、EAR等不同类型项目的构建需求。
|
8月前
|
Kubernetes 容器
Warning FailedScheduling 14m (x12 over 16m) default-scheduler 0/1 nodes are available: 1 node(s
Warning FailedScheduling 14m (x12 over 16m) default-scheduler 0/1 nodes are available: 1 node(s
143 0
springboot计划任务@EnableScheduling和@Scheduled
springboot计划任务@EnableScheduling和@Scheduled
117 0
|
人工智能 算法框架/工具