QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#717516#9531. Weird Ceiling20225954#RE 0ms0kbC++14585b2024-11-06 18:10:282024-11-06 18:10:29

Judging History

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

  • [2024-11-06 18:10:29]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-11-06 18:10:28]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define ll long long

ll solve(ll num){
    vector<ll> v;
    for(int i=1;i*i<=num;i++){
        if(num%i==0){
            v.push_back(i);
            v.push_back(num/i);
        }
    }
    sort(v.begin(),v.end());
    ll ans=0;
    for(int i=0;i<v.size()-1;i++){
        ans+=num/v[i]*(v[i+1]-v[i]);
    }
    ans++;
    cout<<ans<<'\n';
}

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        solve(n);
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Runtime Error

input:

3
5
451
114514

output:


result: