Codeforces Round #164 (Div. 2) B. Buttons

题目:http://codeforces.com/contest/268/problem/B

#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int ans=0;
    for(int i=1;i<n;i++)
    {
        ans+=i*(n-i);
    }
    ans+=n;
    cout<< ans;
}

 

posted @ 2013-01-29 22:11  Daniel Qiu  阅读(109)  评论(0编辑  收藏  举报