实力太water了)
2025-07-11 18:42:52
发布于:广东
5阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int main() {
int op;
cin >> op;
if (op == 1) {
string s;
cin >> s;
long long num = stoll(s, nullptr, 8);
if (num < 2) cout << "false";
else if (num == 2) cout << "true";
else if (num % 2 == 0) cout << "false";
else {
for (long long i = 3; i * i <= num; i += 2) {
if (num % i == 0) {
cout << "false";
return 0;
}
}
cout << "true";
}
} else if (op == 2) {
string a, b;
cin >> a >> b;
long long x = stoll(a, nullptr, 16);
long long y = stoll(b, nullptr, 16);
long long g = __gcd(x, y);
cout << "0x" << hex << g;
}
return 0;
}
这里空空如也
有帮助,赞一个