题意:
给n和m,有一个点集满足0 <= x <= n && 0 <= y <= m
求任意两个点之间的距离不是整数的最大点集
思路:
取n和m的最小值,输出正方形(min(n , m ) , min(n ,m))的对角线就可以了 (x , y 不能同时为零)
1 #include<cstdio> 2 #include<string.h> 3 #include<algorithm> 4 #include<cmath> 5 #include<iostream> 6 #include<vector> 7 #include<queue> 8 #include<set> 9 #include<map> 10 #include<cctype> 11 #define ios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) 12 #define mem(a,x) memset(a,x,sizeof(a)) 13 #define lson rt<<1,l,mid 14 #define rson rt<<1|1,mid + 1,r 15 #define P pair<int,int> 16 #define ull unsigned long long 17 using namespace std; 18 typedef long long ll; 19 const int maxn = 1e6 + 10; 20 const ll mod = 998244353; 21 const int inf = 0x3f3f3f3f; 22 const long long INF = 0x3f3f3f3f3f3f3f3f; 23 const double eps = 1e-7; 24 inline ll read() 25 { 26 ll X = 0, w = 0; char ch = 0; 27 while (!isdigit(ch)) { w |= ch == '-'; ch = getchar(); } 28 while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar(); 29 return w ? -X : X; 30 } 31 ll n, m, k; 32 ll cnt[maxn] = {0}; 33 ll ou = 0, ji = 0; 34 vector<int>vec[maxn]; 35 36 int main() 37 { 38 n = read(), m = read(); 39 int ans = min(n, m); 40 cout << ans + 1 << endl; 41 for (int i = 0; i <= ans; ++i) 42 { 43 cout << ans - i << " " << i << endl; 44 } 45 return 0; 46 }