URI ONLINE JUDGE SOLUTION 1323 - Online Judge

Latest

This is an Online Judge Solution Base Site. We can discuss & Solve any contest solution in Programming.

Friday, April 10, 2020

URI ONLINE JUDGE SOLUTION 1323

Problem Number: 1323
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..