QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#619124#9248. An Easy Math Problemucup-team5071#WA 50ms3840kbC++201.1kb2024-10-07 13:09:172024-10-07 13:09:18

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-07 13:09:18]
  • Judged
  • Verdict: WA
  • Time: 50ms
  • Memory: 3840kb
  • [2024-10-07 13:09:17]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long 
int solve()
{
    int n;cin>>n;
    // int n=1e10;
    int ans=0;
    auto insert= [&](int x,int y){
        int g=gcd(x,y);
        if(g==1)ans++;
    };
    vector<pair<int,int>> v;
    int tot=1;
    {
        int t=n;
        for(int i=2;i*i<=t;i++){
            int y=0;
            while(t%i==0){
                y++;t/=i;
            }
            if(y>0)v.emplace_back(i,y);
        }
        if(t>1)v.emplace_back(t,1);
        for(auto [x,y]:v)tot=tot*(y+1);
    }
    int siz=v.size();
    int all=0;
    for(int i=0;i<(1<<siz);i++){
        int ans1=1,ans2=1;
        for(int j=0;j<siz;j++){
            if(i>>j&1)ans1=ans1*(v[j].second+1);
            else ans2=ans2*(v[j].second+1);
        }
        all+=(ans1-1)*(ans2-1);
        // cout<<"i="<<i<<" ans1="<<ans1<<" ans2="<<ans2<<endl;
    }
    all/=2;
    return all+tot;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T;cin>>T;
    while(T--)cout<<solve()<<"\n";
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3612kb

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: 50ms
memory: 3840kb

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'