codeforces C. Triangle

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\n");
25                printf("%d %d\n",0,0);
26                printf("%d %d\n",x1,y1);
27                printf("%d %d\n",-x2,y2);
28                return 0;
29           }
30        }
31     }
32     printf("NO\n");
33     return 0;
34 }
View Code

 

posted @ 2015-02-04 10:02  null1019  阅读(145)  评论(0编辑  收藏  举报