您的位置:首页 > 其它

codeforces C. Triangle

2015-02-04 10:02 127 查看
http://codeforces.com/contest/408/problem/C

思路:枚举一个边的点的横坐标。。

#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#define maxn 100010
#define ll long long
using namespace std;

int a,b;

int main()
{
int y1,x2,y2;
scanf("%d%d",&a,&b);
for(int x1=1; x1<a; x1++)
{
y1=sqrt(a*a-x1*x1);
if(a*a==x1*x1+y1*y1)
{
x2=y1*b/a;
y2=x1*b/a;
if(b*b==x2*x2+y2*y2&&y1!=y2)
{
printf("YES\n");
printf("%d %d\n",0,0);
printf("%d %d\n",x1,y1);
printf("%d %d\n",-x2,y2);
return 0;
}
}
}
printf("NO\n");
return 0;
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: