本文最后更新于 2492 天前,其中的信息可能已经有所发展或是发生改变。
内容纲要
雅可比四平方定理(Jacobi’s four square theorem)是指一个数可以由四个数的平方之和得到。
参考例题:CUP 2342
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll n, ans;
cin >> n;
(n <<= 1)++;
ans = n + 1;
for (ll i = 3; i <= n / i; i++) {
if (!(n % i)) {
ans += i;
if (i != n / i) {
ans += n / i;
}
}
}
cout << ans << "\n";
#ifndef ONLINE_JUDGE
cout.flush();
#endif
}