QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#683862#9531. Weird CeilingyxlTL 0ms0kbC++14536b2024-10-28 00:48:402024-10-28 00:48:41

Judging History

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

  • [2024-10-28 00:48:41]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-10-28 00:48:40]
  • 提交

answer

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<map>
#include<deque>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<iomanip>

using namespace std;

int f(int a,int b){
	int i=b;
	while (i>=2){
		if (a%i==0){
			return a/i;
		}
		i--;
	}
	return a;
}
int main(){
	int t,n;
	cin>>t;
	while(t--){
		cin>>n;
		long long sum=0;
		for (int i=1;i<=n;i++){
			sum+=f(n,i);
		}
		cout<<sum<<endl;
	}
	return 0;
}

詳細信息

Test #1:

score: 0
Time Limit Exceeded

input:

3
5
451
114514

output:

21
10251

result: