QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#787991#9531. Weird CeilingMervinLuoTL 0ms0kbC++23606b2024-11-27 15:30:262024-11-27 15:30:27

Judging History

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

  • [2024-11-27 15:30:27]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-11-27 15:30:26]
  • 提交

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 ans = 0;
        for(int i = 1; i <= n; i++){
            ans += f(n, i);
        }
        cout << ans  << endl;
    }
    return 0;
}
/*

*/

详细

Test #1:

score: 0
Time Limit Exceeded

input:

3
5
451
114514

output:

21
10251

result: