zoukankan      html  css  js  c++  java
  • 【Project Euler】8 第八题

    

    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柯于旺 原创文章,如需转载请联系本人。

  • 相关阅读:
    caffe学习笔记(1)安装
    windows下遍历文件夹
    图像处理之OpenCV
    OpenCV的安装和使用
    使用cpplint检测代码规范
    图像处理之原理
    Python 在cmd中import模块成功,但是在jupyter notebook中No module xxx found
    Win10上使用VS2015编译Caffe2
    Win10, VS2017环境下OpenCV3.4.2的配置
    C++ main函数的参数
  • 原文地址:https://www.cnblogs.com/NoMasp/p/4786194.html
Copyright © 2011-2022 走看看