QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#691556#9248. An Easy Math ProblemCore_65536#TL 0ms3612kbC++201.0kb2024-10-31 11:58:542024-10-31 11:58: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-31 11:58:56]
  • Judged
  • Verdict: TL
  • Time: 0ms
  • Memory: 3612kb
  • [2024-10-31 11:58:54]
  • Submitted

answer

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

void solve()
{
   
        ll n;
        cin>>n;
        // 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();
        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;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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
Time Limit Exceeded

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:


result: