QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#551956 | #9248. An Easy Math Problem | ucup-team4504# | RE | 0ms | 3628kb | C++14 | 927b | 2024-09-07 19:22:01 | 2024-09-07 19:22:02 |
Judging History
This is the latest submission verdict.
- [2024-10-31 22:36:43]
- hack成功,自动添加数据
- (/hack/1098)
- [2024-10-31 22:13:58]
- hack成功,自动添加数据
- (/hack/1096)
- [2024-10-31 22:00:43]
- hack成功,自动添加数据
- (/hack/1095)
- [2024-09-07 19:22:01]
- Submitted
answer
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
using ll = long long;
int q, m;
ll n, ans;
vector<int> vec;
ll num[100];
int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
cin >> q;
while (q--){
vec.clear();
ans = 0;
cin >> n;
for (ll i = 2; i * i <= n; i++)
if (n % i == 0){
int cnt = 0;
while (n % i == 0){
n /= i;
cnt++;
}
vec.push_back(cnt);
}
if (n > 1) vec.push_back(1);
m = vec.size();
for (int i = 0; i < (1 << m); i++){
num[i] = 1;
for (int j = 0; j < m; j++)
if ((i >> j) & 1)
num[i] *= vec[j];
}
for (int i = 0; i < (1 << m); i++){
int o = (1 << m) - 1 - i;
for (int j = o; ; j = (j - 1) & o){
ans += num[i] * num[j];
if (!j) break;
}
}
cout << (ans + 1) / 2 << endl;
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3628kb
input:
10 1 2 3 4 5 6 7 8 9 10
output:
1 2 2 3 2 5 2 4 3 5
result:
ok 10 lines
Test #2:
score: -100
Runtime Error
input:
2000 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 646969323...