QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#698633 | #9248. An Easy Math Problem | SDNUyuqi# | WA | 119ms | 7652kb | C++23 | 1.7kb | 2024-11-01 20:56:28 | 2024-11-01 20:56:28 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long ll;
const int N=1e6+100;
const int M=1e5;
int flag[N];
vector<int>p;
map<int,int>yz;
ll su;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
for(int i=2;i<=M;i++)
{
if(!flag[i])
{
p.push_back(i);
}
for(auto j:p)
{
if(j*i>N)
{
break;
}
flag[j*i]=1;
if(i%j==0)
{
break;
}
}
}
int T;
cin>>T;
while(T--)
{
su=1;
yz.clear();
ll n;
cin>>n;
for(auto i:p)
{
if(n%i!=0)
{
continue;
}
while(n%i==0)
{
n/=i;
yz[i]++;
}
su*=(yz[i]+1);
}
if(n!=1)
{
yz[n]++;
su*=(yz[n]+1);
}
ll an=0;
vector<pair<int,int>>zy;
for(auto [i,j]:yz)
{
zy.push_back({i,j});
}
int nu=yz.size();
for(int i=1;i<(1<<nu)-1;i++)
{
ll mul=1;
for(int j=0;j<nu;j++)
{
if((i>>j)&1)
{
mul*=zy[j].second+1;
}
}
if(mul==su)
{
continue;
}
an+=(mul-1)*(su/mul-1);
}
cout<<an/2+su<<endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 7652kb
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
Wrong Answer
time: 119ms
memory: 7600kb
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:
466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775 466775...
result:
wrong answer 1st lines differ - expected: '29525', found: '466775'