QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#747674 | #9248. An Easy Math Problem | xianjing# | TL | 3ms | 3800kb | C++23 | 816b | 2024-11-14 17:50:49 | 2024-11-14 17:50:49 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve(){
int n,cnt = 0;
cin >> n;
vector<int> s;
for(int i = 2;i <= 1e5;i ++){
int res = 0;
while(n % i == 0){
n /= i;
res ++;
}
if(res) s.push_back(res);
}
if(n != 1) s.push_back(1);
cnt = s.size();
// cout << cnt << '\n';
int res = 1,ans = 0;
auto dfs = [&](auto self,int x) -> void{
if(x == cnt) {
ans += res;
return;
}
for(int i = 0;i < 3;i ++){
if(i != 0){
res *= s[x];
self(self,x + 1);
res /= s[x];
} else{
self(self,x + 1);
}
}
};
dfs(dfs,0);
// cout << cnt << " " << ans << '\n';
ans -= 1;
ans /= 2;
ans += 1;
cout << ans << '\n';
}
signed main(){
int t = 1;
cin >> t;
while(t --){
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 3ms
memory: 3800kb
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
Time Limit Exceeded
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...
output:
29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 29525 ...