QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#788051#9531. Weird CeilingMervinLuoTL 0ms0kbC++23874b2024-11-27 15:43:232024-11-27 15:43:23

Judging History

This is the latest submission verdict.

  • [2024-11-27 15:43:23]
  • Judged
  • Verdict: TL
  • Time: 0ms
  • Memory: 0kb
  • [2024-11-27 15:43:23]
  • Submitted

answer

#include<bits/stdc++.h>
#define int long long
#define end '\n'
using namespace std;
const int INF = 1e19;
const int maxn = 1e9;

int f(int n, int i){
    int b = i;
    while( b >= 2){
        if(n % b == 0) break;
        else b = b - 1;
    }
    if(n % b == 0) return n / b;
    return n;
}
signed main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;cin >> t;
    while(t--){
        int n;cin >> n;
        int cnt = 0 , pa;
        if (n > 1000){
            for(int i = 1; i <= n; i++){
                pa += f(1000 , i);
            }
        }
        while(n > 1000){
            cnt++;
            n = n / 1000;
        }
        int ans = 0;
        for(int i = 1; i <= n; i++){
            ans += f(n, i);
        }
        ans = ans + pa*cnt;
        cout << ans  << endl;
    }
    return 0;
}
/*

*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Time Limit Exceeded

input:

3
5
451
114514

output:

21
10251

result: