Problem Name: Feynman
Author’s Name: By Inês Kereki Uruguai
Timelimit: 1
Problem Category: AD-HOC
Problem Source: https://www.urionlinejudge.com.br/judge/en/problems/view/1323
Solution:
#include<bits/stdc++.h>using namespace std;
int main()
{
int n;
while(cin>>n&&n)
{
long long x=(n*(n+1)*(2*n+1))/6;
cout<<x<<endl;
}
return 0;
}
No comments:
Post a Comment
Thanks..