QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#672292#9248. An Easy Math Problemfgz#WA 0ms3592kbC++23904b2024-10-24 16:18:542024-10-24 16:18:56

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-24 16:18:56]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3592kb
  • [2024-10-24 16:18:54]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;

#define int long long


void solve(){
    int n;
    cin >> n;
    if(n==1){
        cout<<1<<endl;
        return;
    }
    vector<pair<int,int>> s;
    int cnt=0;
    for(int i=2;i*i<=n;i++){
        while(n%i==0){
            n/=i;
            cnt++;
        }
        if(cnt)s.push_back({i,cnt});
        cnt=0;
    }
    if(n!=1){
        s.push_back({n,1});
    }

    int ans=1;
    for(int i=0;i<s.size();i++){
        ans*=(s[i].second+1);
    }

    for(int i=0;i<s.size();i++){
        int sum=1;
        for(int j=i+1;j<s.size();j++){
            sum*=(s[j].second+1);
        }
        sum--;
        for(int j=0;j<i;j++){
            sum*=(s[j].second+1);
        }
        ans+=sum;
    }
    cout<<ans<<endl;
}
signed main(){
    int T = 1;
    cin >> T;

    while(T --)
        solve();
}

詳細信息

Test #1:

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

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: 0ms
memory: 3448kb

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:

5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
5121
...

result:

wrong answer 1st lines differ - expected: '29525', found: '5121'