QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#710099 | #9248. An Easy Math Problem | jay248 | TL | 4ms | 3744kb | C++14 | 870b | 2024-11-04 18:39:46 | 2024-11-04 18:39:48 |
Judging History
answer
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main(){
int q;
long n;
cin>>q;
int cnt;
int ans;
int nn;
while(q--){
vector<int> v;
cin>>n;
nn=n;
cnt=0;
while(n%2==0){
cnt++;
n/=2;
}
v.push_back(cnt);
cnt=0;
int i=3;
while(true){
if(n==1) break;
if(i>sqrt(nn)){
v.push_back(1); break;
}
while(n%i==0){
cnt++;
n/=i;
}
v.push_back(cnt);
cnt=0;
i+=2;
}
ans=1;
for(int i=0; i<v.size(); i++){
ans *= (v[i]*2+1);
}
ans++;
ans/=2;
cout<<ans<<'\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3744kb
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: 0
Accepted
time: 4ms
memory: 3744kb
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 ...
result:
ok 2000 lines
Test #3:
score: -100
Time Limit Exceeded
input:
2000 1763047095 79735483 1016286871 2864801397 2327774116 2668010360 3469893354 3634459021 1613699068 781737219 574741575 2763134701 1458502604 1822260248 2281150332 2924219311 2493931196 3735904708 158802001 2006921221 729928782 1974841034 727412600 2873393292 1291087179 2741607663 1893408215 29827...
output:
14 5 2