-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11526.cpp
More file actions
32 lines (31 loc) · 672 Bytes
/
11526.cpp
File metadata and controls
32 lines (31 loc) · 672 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <bits/stdc++.h>
int main() {
int t;
long long last, i, n, j, sum;
scanf("%d", &t);
while (t--) {
j = 0;
scanf("%lld", &n);
if (n <= 0)
sum = 0;
else if (n == 2)
sum = 3;
else if (n == 3)
sum = 5;
else {
sum = n;
last = n;
for (i = 2; i * i <= n; i++) {
j = n / i;
sum += j;
sum += (last - j) * (i - 1);
last = j;
}
if (j == i) {
sum += (i - 1);
}
}
printf("%lld\n", sum);
}
return 0;
}