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

    版权声明:本文为 NoMasp柯于旺 原创文章,如需转载请联系本人。

  • 相关阅读:
    系统集群安装
    用ASP.net判断上传文件类型的三种方法
    C#中利用JQuery实现视频网站
    云计算和大数据
    c# Dictionary 中Keys.ToArray<>方法的细节测试
    DateTime compare
    Dictionary的遍历和修改
    C# 键值对数据排序
    ant使用小结
    给我们的7句话
  • 原文地址:https://www.cnblogs.com/NoMasp/p/4786193.html
Copyright © 2020-2023  润新知