提交时间:2020-08-22 10:55:49
运行 ID: 6030
#include<cstdio> #include<iostream> using namespace std; int main(){ int k,money,i; money = 0;i = 1; cin >> k; while(k > 0){ if(k>=i){ money += i*i; } else{ money += k*i; } k -= i; i++; } cout << money; return 0; }