[Codeforces Round #164 (Div. 2)]C. Beautiful Sets of Points

地址:http://codeforces.com/contest/268/problem/C

给定一个平面0 ≤ x ≤ n0 ≤ y ≤ mx + y > 0,在其中寻找一个最大的坐标均为整数的点集,且每两点间的距离不为整数

找无理数也可以,三角形可以变成一个线段,只要两段距离为无理数,那么第三个距离也是无理数

所以寻找这样的平面内最大的正方形,选择其副对角线上的点输出

 1 #include <iostream>
 2 #include <algorithm>
 3 using namespace std;
 4 
 5 int n,m;
 6 
 7 int main()
 8 {
 9     ios::sync_with_stdio(false);
10     cin>>n>>m;
11     int min=m<n?m:n,x,y;
12     cout<<min+1<<endl;
13     for(x=0,y=min;x<=min && y>=0;x++,y--)
14             cout<<x<<" "<<y<<endl;
15     return 0;
16 }

 

posted @ 2013-01-29 17:36  tjsuhst  阅读(334)  评论(0编辑  收藏  举报