【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);
                            }
                        }
                    }
                }
            }
        }

目录
相关文章
|
3月前
|
SQL 开发框架 安全
【译】You probably should stop using a custom TaskScheduler
以更明确的方式控制并发 我认为并发控制(又称速率限制)是应用程序非常重要的方面,重要的方面应该是明确的。 TaskScheduler 相当低级别的工具,我宁愿拥有更高级别的工具。如果工作是 CPU 密集型的,那么 PLINQ 或类似 ActionBlock TPL DataFlow 的东西可能是更好的选择。 如果工作主要是 IO 绑定和异步的,那么可以使用 Parallel.ForEachAsync 或 Polly.RateLimiting 基于 的 SemaphoreSlim 自定义帮助程序类。 结论
47 3
|
5月前
|
Apache 调度 数据库
Apache DolphinScheduler VS WhaleScheduler
Apache DolphinScheduler VS WhaleScheduler
593 59
|
5月前
|
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
112 0
|
资源调度 调度
SchedulerX - Hello world
介绍 SchedulerX 是阿里中间件团队开发的一款分布式任务调度产品,在阿里内部有着广泛的使用,经过集团内上千个业务应用历经多年打磨而成。
3935 0
|
人工智能 算法框架/工具