QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#662306 | #9248. An Easy Math Problem | 123BVN | RE | 0ms | 0kb | C++23 | 939b | 2024-10-20 22:44:48 | 2024-10-20 22:44:48 |
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-10-20 22:44:48]
- Submitted
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
map<int, int>mp;
void solve() {
int n,m;
cin >> n;
m = n;
if (mp[n]) {
cout << mp[n] << endl;
return;
}
vector<int>v;
for (int i = 2; i <= n / i; i++) {
int cnt = 0;
while (n % i == 0) {
cnt++;
n /= i;
}
v.push_back(cnt);
}
if (n > 1)v.push_back(1);
n = 2;
for (int i = 1; i < v.size(); i++) {
n *= 2;
}
int ans = 1;
int op = 1;
for (int j = 0; j < v.size(); j++)op *= (v[j] + 1);
for (int i = 0; i < n; i++) {
int x = i;
int pos1 = 1, pos2 = op;
int cnt = 0,j=0;
while (x) {
if (x % 2)pos1 *= v[j], pos2 /= (v[j] + 1);
x /= 2;
j++;
}
ans += pos1 * pos2;
}
mp[m] = ans / 2;
cout << ans / 2 << "\n";
}
signed main() {
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int _ = 1;
cin >> _;
while (_--) {
solve();
}//ut << _<<endl;
return 0;
}
详细
Test #1:
score: 0
Runtime Error
input:
10 1 2 3 4 5 6 7 8 9 10