← Back to List

5724번: 파인만 ↗

Solutions

C++14
154 B | 154 chars
#include <iostream>
using namespace std;
long long N;
int main()
{
	while(1)
	{
		cin>>N;
		if(N==0) return false;
		cout<<N*(N+1)*(2*N+1)/6<<endl;	
	}
}