QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#694566 | #9248. An Easy Math Problem | xunxxxx | WA | 12ms | 5480kb | C++23 | 903b | 2024-10-31 18:12:43 | 2024-10-31 18:12:47 |
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-31 18:12:43]
- Submitted
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
map<int,int>mp;
void solve()
{
ll n;
cin>>n;
if(mp.count(n))
{
cout<<n<<"\n";
return ;
}
vector<ll > pq;
for(ll i=1;i*i<=n;i++)
{
if(n%i==0)
{
// n:i n/i
pq.push_back(i);
if(i!=n/i) pq.push_back(n/i);
}
}
set<pair<ll ,ll > > ans;
for(auto t:pq)
{
for(ll i=1;i*i<=t;i++)
{
if(t%i==0)
{
ll st=__gcd(i,t/i);
ans.insert({i/st,(t/i)/st});
}
}
}
mp[n]=ans.size();
cout<<ans.size()<<endl;
}
int main (){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t=1;
cin>>t;
while(t--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3812kb
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: 12ms
memory: 5480kb
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 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 64696932...
result:
wrong answer 2nd lines differ - expected: '29525', found: '6469693230'