社区讨论
满江紫求条
P10720[GESP202406 五级] 小杨的幸运数字参与者 4已保存回复 4
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 4 条
- 当前快照
- 1 份
- 快照标识符
- @mhj90smi
- 此快照首次捕获于
- 2025/11/03 22:42 4 个月前
- 此快照最后确认于
- 2025/11/03 22:42 4 个月前
CPP
#include <bits/stdc++.h>
using namespace std;
bool f(int k, int i, int ans) {
if (k == 1) {
if (ans == 2)
return 1;
else
return 0;
}
if (k % i == 0)
ans++;
while (k % i == 0)
k /= i;
f(k, i + 1, ans);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int n;
cin >> n;
for (int i = 1, a; i <= n; i++) {
cin >> a;
if (f(a, 2, 0))
cout << 1 << '\n';
else
cout << 0 << '\n';
}
return 0;
}
回复
共 4 条回复,欢迎继续交流。
正在加载回复...