=(n^3+5n)/6+1
/** \brief hdu 1290 * * \param date 2014/7/25 * \param state AC * \return * */ #include <iostream> #include <fstream> using namespace std; int main() { //cout << "Hello world!" << endl; //freopen("input.txt","r",stdin); int n; while(scanf("%d",&n)!=EOF) { cout<<(n*n*n+5*n)/6+1<<endl; } return 0; }
原文地址:http://blog.csdn.net/greenapple_shan/article/details/38126139