|
- #include <algorithm>
- #include <iostream>
- #include <cmath>
- #include <cstring>
- #include <map>
- #include <string>
- #include <vector>
- #include <queue>
- #include <stack>
- #include <cstdio>
- #include <cstdlib>
- using namespace std;
- int k,n=0,all=0;
- int main()
- {
- scanf("%d",&k);
- for(n=1;k-n>=0;k-=n,n++)
- all+=n*n;
- printf("%d\n",all+k*n);
- return 0;
- }
复制代码 |
|