2025-01-28 15:53:43 -06:00

41 lines
736 B
C++

#include <cstdio>
#include <iostream>
#include <cmath>
int main() {
int t;
std::scanf("%d", &t);
while (t--) {
int n;
std::scanf("%d", &n);
if (n == 1) {
std::cout << "0" << std::endl;
continue;
}
int total = 1;
int r = (int) std::floor(std::sqrt(n));
std::cout << std::endl;
for (int n2 = 2; n2 < r + 1; n2++) {
if (n % n2 == 0) {
int other = n / n2;
if (other != n2) {
total += other;
}
total += n2;
}
}
std::cout << total << std::endl;
}
return 0;
}