Code Submission Evaluation System Login

CSES - HIIT Open 2017

HIIT Open 2017

Contest start:2017-05-27 11:00:00
Contest end:2017-05-27 16:00:00

Task list | Submit code | Submissions | Messages | Scoreboard


History
2017-05-27 12:38:36
2017-05-27 11:32:54
2017-05-27 11:32:01
2017-05-27 11:24:44
2017-05-27 11:20:05
Task:Algorithm
Sender:IOG
Submission time:2017-05-27 12:38:36
Status:READY
Result:ACCEPTED

Show test data

Code

#include <bits/stdc++.h>

using namespace std;

int main(void)
{
 cin.sync_with_stdio(0);
 cin.tie(0);
 int n = 0;
 
 cin >> n;
 
 long long res = 0, nn = n;
 
 for (int i = 1; i <= n; i++)
 {
     res += i*nn;
     --nn;
 }
 
 
 cout << res << "\n";
     
}