http://codeforces.com/contest/408/problem/C
思路:枚举一个边的点的横坐标。。
1 #include <cstdio> 2 #include <cmath> 3 #include <cstring> 4 #include <algorithm> 5 #define maxn 100010 6 #define ll long long 7 using namespace std; 8 9 int a,b; 10 11 int main() 12 { 13 int y1,x2,y2; 14 scanf("%d%d",&a,&b); 15 for(int x1=1; x1<a; x1++) 16 { 17 y1=sqrt(a*a-x1*x1); 18 if(a*a==x1*x1+y1*y1) 19 { 20 x2=y1*b/a; 21 y2=x1*b/a; 22 if(b*b==x2*x2+y2*y2&&y1!=y2) 23 { 24 printf("YES "); 25 printf("%d %d ",0,0); 26 printf("%d %d ",x1,y1); 27 printf("%d %d ",-x2,y2); 28 return 0; 29 } 30 } 31 } 32 printf("NO "); 33 return 0; 34 }