QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#700784#9248. An Easy Math Problem53Dawns#WA 475ms4644kbC++231.5kb2024-11-02 13:23:332024-11-02 13:23:33

Judging History

This is the latest submission verdict.

  • [2024-11-02 13:23:33]
  • Judged
  • Verdict: WA
  • Time: 475ms
  • Memory: 4644kb
  • [2024-11-02 13:23:33]
  • Submitted

answer

#include<bits/stdc++.h>
#define deg(a) cout << #a << '=' << a << "\n"
#define all(a) a.begin(),a.end()
#define lowbit(x)  ((x)&(-x))
#define find1(x)  (__builtin_popcount(x))
#define pll pair<int,int>
#define int long long
#define endl '\n'
#define ff first
#define ss second
#define ULL unsigned long long 
#define lc p << 1
#define rc p << 1|1
using namespace std;
using i64 = long long;
const int N = 1e5+10;
const int M = 1e6+10;
const int mod2 = 998244353;
const int mod1 = 1e9+7;
const int inf = 0x3f3f3f3f3f3f3f;
const double eps = 1e-12;
const int bit1 = 13331;// 底数1
const int bit2 = 13;// 底数

int f[N];

void init(){
    for(int i=1;i<N;++i){
        for(int j=i;j<N;j+=i){
            f[j]++;
        }
    }

    for(int i=1;i<N;++i){
        f[i]=(f[i]+1)/2;
    }

    for(int i=2;i<N;++i){
        int x=i*i;
        for(int j=x;j<N;j+=x){
            f[j]--;
        }
    }
}

void solve(){
    int n;
    cin>>n;

    vector<int>d;

    for(int i=1;i*i<=n;++i){
        if(n%i==0){
            d.push_back(i);
            if(n/i!=i) d.push_back(n/i);
        }
    }


    int ans=0;
    for(auto v:d){
        // cout<<v<<' ';
        if(v<N) ans+=f[v];
        else{
            ans++;
        }
    }
    // cout<<'\n';
    cout<<ans<<'\n';
}
signed main(){      
    cin.tie(nullptr); 
    ios::sync_with_stdio(false);
    int kk = 1;
    cin >> kk;
    init();
    // cin.get();
    while(kk--) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 4644kb

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: 475ms
memory: 4436kb

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:

5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
5415
...

result:

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