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:55:54
2017-05-27 11:14:47
Task:Algorithm
Sender:HIIT AND RUN
Submission time:2017-05-27 12:55:54
Status:READY
Result:ACCEPTED

Show test data

Code

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main() {
    ios_base::sync_with_stdio(0);

    ll n;
    cin >> n;
/*    
    long long z = 0;
    for (int a = 1; a <= n; a++)
        for (int b = a; b <= n; b++)
            for (int c = a; c <= b; c++)
                z++;
    cout << z << "\n";
  

    for (ll n = 1; n < 1000000; ++n) {

    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += (i*(i+1ll)) / 2ll;
    }*/
    
    ll ans2 = 0;
    for (int i = 1; i <= n; i++) {
        ans2 += i * (n - i + 1);
    }
    
    cout << ans2 << "\n";
    
    
}