QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#687946 | #9531. Weird Ceiling | DrMissRight | TL | 0ms | 0kb | C++20 | 684b | 2024-10-29 22:05:04 | 2024-10-29 22:05:05 |
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
using ULL = unsigned long long;
using LLL = __int128;
using PII = pair<int, int>;
const int inf = 0x3f3f3f3f;
void solve(){
int n;
cin >> n;
int ans1 = n + 1;
int ans2 = 0;
for (int i = 2; i <= n - 1; ++ i) {
bool fl = false;
for (int j = i; j >= 2; -- j) {
if (n % j == 0) {
fl = true;
ans2 += n / j;
break;
}
}
if (!fl) {
ans2 += n;
}
}
cout << ans1 + ans2 << '\n';
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int T = 1;
cin >> T;
while(T --) solve();
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