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;
}

转载于:https://www.cnblogs.com/danielqiu/archive/2013/01/29/2882110.html

猜你喜欢

转载自blog.csdn.net/weixin_34306676/article/details/93795288