QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#696154#9248. An Easy Math ProblemCore_65536TL 283ms5484kbC++231.2kb2024-10-31 21:41:422024-10-31 22:20:01

Judging History

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

  • [2024-10-31 22:36:43]
  • hack成功,自动添加数据
  • (/hack/1098)
  • [2024-10-31 22:20:01]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:TL
  • 用时:283ms
  • 内存:5484kb
  • [2024-10-31 22:13:58]
  • hack成功,自动添加数据
  • (/hack/1096)
  • [2024-10-31 22:10:05]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:279ms
  • 内存:5428kb
  • [2024-10-31 22:00:43]
  • hack成功,自动添加数据
  • (/hack/1095)
  • [2024-10-31 21:41:42]
  • 评测
  • 测评结果:100
  • 用时:283ms
  • 内存:5412kb
  • [2024-10-31 21:41:42]
  • 提交

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)
            {
                pq.push_back(i);
                if(i!=n/i) pq.push_back(n/i);
            }
        }
        sort(pq.begin(),pq.end());
        set<pair<ll,ll> >ans;
        
        for(int i=0;i<pq.size();i++)
        {
            for(int j=i;j<pq.size();j++)
            {
                if(n%(pq[i]*pq[j])==0)
                {
                    ll g=__gcd(pq[i],pq[j]);
                    ans.insert({pq[i]/g,pq[j]/g});
                }
                if(pq[i]*pq[j]>n) break;
            }
        }
        
        cout<<ans.size();
        mpp[n] = ans.size();
        cout<<endl;
}

int main ()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    cin>>t;
    while(t--)
    {
        solve();
    }
    
    return 0;
}

详细

Test #1:

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

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: 8ms
memory: 5484kb

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: 283ms
memory: 4380kb

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 3

input:

2000
10000000000
9999999800
9999999600
9999999400
9999999200
9999999000
9999998800
9999998600
9999998400
9999998200
9999998000
9999997800
9999997600
9999997400
9999997200
9999997000
9999996800
9999996600
9999996400
9999996200
9999996000
9999995800
9999995600
9999995400
9999995200
9999995000
99999948...

output:

221
473
608
158
83
1103
203
158
13163
53
95
473
248
263
1013
221
113
2363
608
158
1040
473
203
368
878
851
203
263
248
473
284
158
1913
158
68
221
248
4253
608
158
137
788
608
158
743
74
203
1418
113
473
22964
473
83
1418
68
221
4388
263
68
2363
116
158
203
158
1283
1985
68
158
413
1418
851
1418
878...

result: