QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#696177#9248. An Easy Math ProblemCore_65536TL 944ms5360kbC++23955b2024-10-31 21:44:142024-10-31 22:10:12

Judging History

你现在查看的是最新测评结果

  • [2024-10-31 22:36:43]
  • hack成功,自动添加数据
  • (/hack/1098)
  • [2024-10-31 22:13:58]
  • hack成功,自动添加数据
  • (/hack/1096)
  • [2024-10-31 22:10:12]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:TL
  • 用时:944ms
  • 内存:5360kb
  • [2024-10-31 22:00:43]
  • hack成功,自动添加数据
  • (/hack/1095)
  • [2024-10-31 21:44:17]
  • 评测
  • 测评结果:100
  • 用时:944ms
  • 内存:5672kb
  • [2024-10-31 21:44:14]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'

unordered_map<int, int> mpp;
void solve()
{
    ll n;
    cin>>n;
if(mpp.count(n)){
            cout<<mpp[n]<<endl;
            return ;
        }
    // n=10000000000;
    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});
            }
        }
    }
    cout<<ans.size()<<endl;
mpp[n] = ans.size();
}

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: 1ms
memory: 3652kb

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: 0
Accepted
time: 9ms
memory: 5360kb

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
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
...

result:

ok 2000 lines

Test #3:

score: 0
Accepted
time: 944ms
memory: 4132kb

input:

2000
1763047095
79735483
1016286871
2864801397
2327774116
2668010360
3469893354
3634459021
1613699068
781737219
574741575
2763134701
1458502604
1822260248
2281150332
2924219311
2493931196
3735904708
158802001
2006921221
729928782
1974841034
727412600
2873393292
1291087179
2741607663
1893408215
29827...

output:

14
5
2
5
23
95
68
14
8
68
203
14
23
32
38
41
8
8
14
2
608
41
158
338
23
41
14
5
14
41
14
203
41
14
17
446
5
53
59
878
2
14
365
203
14
203
2
122
32
95
41
41
5
23
14
41
5
5
14
122
23
203
608
23
41
122
2
14
95
2
68
41
203
14
230
41
68
23
50
14
32
14
8
5
5
5
68
68
122
293
473
5
41
41
14
2
14
14
5
2
122
...

result:

ok 2000 lines

Extra Test:

score: -3
Extra Test Failed : Time Limit Exceeded on 2

input:

2000
10000000000
9999999998
9999999996
9999999994
9999999992
9999999990
9999999988
9999999986
9999999984
9999999982
9999999980
9999999978
9999999976
9999999974
9999999972
9999999970
9999999968
9999999966
9999999964
9999999962
9999999960
9999999958
9999999956
9999999954
9999999952
9999999950
99999999...

output:


result: