QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#710096#9248. An Easy Math Problemjay248WA 0ms3748kbC++14870b2024-11-04 18:38:502024-11-04 18:38:50

Judging History

This is the latest submission verdict.

  • [2024-11-04 18:38:50]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3748kb
  • [2024-11-04 18:38:50]
  • Submitted

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(n>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';
    }
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3748kb

input:

10
1
2
3
4
5
6
7
8
9
10

output:

1
2
2
3
2
5
2
4
2
5

result:

wrong answer 9th lines differ - expected: '3', found: '2'