QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#787741#9521. Giving Directions in HarbinCSQ#WA 0ms3776kbC++17689b2024-11-27 14:20:352024-11-27 14:20:35

Judging History

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

  • [2024-11-27 14:20:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3776kb
  • [2024-11-27 14:20:35]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define sz(a) (int)(a.size())
typedef long long int ll;

int main()
{
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int>d;
        for(int i=1;i*i<=n;i++){
            if(n%i == 0){
                d.push_back(i);
                d.push_back(n/i);
            }
        }
        sort(d.begin(),d.end());
        
        ll ans = 0;
        d.push_back(n);
        for(int i=0;i+1<sz(d);i++){
            ll dist = d[i+1] - d[i];
            //cout<<dist<<" "<<d[i]<<'\n';
            ans += dist * (n/d[i]);
        }
        ans++;
        cout<<ans<<'\n';

    }


}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3776kb

input:

1
2
S 2
E 1

output:

3

result:

wrong output format Unexpected end of file - token expected (test case 1)