QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#680265#9248. An Easy Math Problem22U069#TL 0ms3592kbC++20774b2024-10-26 20:26:492024-10-26 20:26:49

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-26 20:26:49]
  • Judged
  • Verdict: TL
  • Time: 0ms
  • Memory: 3592kb
  • [2024-10-26 20:26:49]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
#define int long long
int a[N],b[N];
void solve() 
{
    int n;
    cin>>n;
    vector<int> v;
    for(int i=1;i<=n/i;i++)
    {
        if(n%i==0)
        {
            v.push_back(i);
            if(n/i!=i) v.push_back(n/i);
        }
    }
    map<double,int> mp;
    //sort(v.begin(),v,end());
    int ans=0;
    for(int i=0;i<v.size();i++)
    {
        for(int j=0;j<v.size();j++)
        {
            if(v[i]<=v[j])
            {
               if( mp[(double)v[i]/v[j]]) continue;
               mp[(double)v[i]/v[j]]++;
               ans++;
            }
        }
    }
    cout<<ans<<endl;
}
signed main()
{
    int T;
    cin>>T;
    while(T--) solve();
}

詳細信息

Test #1:

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

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:

29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525

result: