// UVa 12149 - Feynman #include <iostream> using namespace std; int main() { unsigned long long int T[101]; for (int n = 1; n <= 100; n++) { T[n] = 0; for (int i = 1; i <= n; i++) T[n] += (n - i + 1) * (n - i + 1); } int n; while ((cin >> n) && (n)) cout << T[n] << endl; return 0; }
No comments:
Post a Comment