QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#717516 | #9531. Weird Ceiling | 20225954# | RE | 0ms | 0kb | C++14 | 585b | 2024-11-06 18:10:28 | 2024-11-06 18:10:29 |
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