HDU 1407 测试你是否和LTC水平一样高

来源:互联网 发布:java中四舍五入的方法 编辑:程序博客网 时间:2024/05/20 11:50

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1407

代码:

#include <iostream>#include<cstdio>using namespace std;int main(){    int num;    int x,y,z;    while(scanf("%d",&num)!=EOF)    {        for(x=1;x<=100;x++)           for(y=x;y<=100;y++)             for(z=y;z<=100;z++)               {                   if((x*x+y*y+z*z)==num)                          {                              goto cc;                          }               }       cc: printf("%d %d %d\n",x,y,z);    }    return 0;}


0 0