← Back to List

1834번: 나머지와 몫이 같은 수 ↗

Solutions

C++14
159 B | 159 chars
#include <iostream>
using namespace std;
long long int N;
int main()
{
	cin>>N;
	if(N%2==0)
	{
		cout<<(N/2)*(N*N-1);
	}
	else 
	{
		cout<<N*((N*N-1)/2);
	}
}