标签:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1407
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 14769 Accepted Submission(s): 4843
1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 5 using namespace std; 6 7 int n; 8 9 void fun() 10 { 11 for (int i=1; i<=100; i++) 12 { 13 for (int j=i; j<=100; j++) 14 { 15 for (int k=j; k<=100; k++) 16 { 17 if (i*i+j*j+k*k==n) 18 { 19 printf ("%d %d %d\n",i,j,k); 20 return ; 21 } 22 } 23 24 } 25 } 26 } 27 28 int main () 29 { 30 while (~scanf("%d",&n)) 31 { 32 fun(); 33 } 34 return 0; 35 }
标签:
原文地址:http://www.cnblogs.com/qq-star/p/4622914.html