3 条题解
-
1褚沛宸 LV 7 @ 2022-08-12 16:24:31
妙啊
-
02019-11-23 00:33:26@
#include <iostream> #include <stdio.h> #include <cstring> using namespace std; int gcd(int a, int b){ if(b == 0) return a; return gcd(b, a%b); } int main(){ int k; long int arr[8][2]; cin >> k; int i = 0; int j = 0; string s; while(k--){ cin >> arr[i][0] >> arr[i][1]; int a = arr[i][0]; int b = arr[i][1]; if(gcd(a, b) != 1 || (a+b)%2 == 0){ s += 'n'; } else s += 'y'; i++; } cout << s << endl; return 0; }
//要求是必须两个整数互质,且相加之后和为奇数;
-
-32019-11-22 23:42:21@
#include <iostream> #include <stdio.h> #include <cstring> using namespace std; int main(){ int k; long int arr[8][2]; cin >> k; int i = 0; int j = 0; string s; while(k--){ cin >> arr[i][0] >> arr[i][1]; //cout << arr[i][0] << " " << arr[i][1] << endl; if((arr[i][0] + arr[i][1])%2 == 0){ s += 'n'; } else s += 'y'; i++; } i = 0; cout << s << endl; return 0; }
//快速六十分解法
- 1