#include<bits/stdc++.h> using namespace std; int he(int n){ if(n==1) return 1; else return he(n-1)+n-1; } int s=0,n; int main(){ for(int i=1;s<5000;i++){ s=he(i)+s; } cout<<s; return 0; } /************************************************************** Problem: 1146 User: wangchenyu Language: C++ Result: Accepted Time:5 ms Memory:2072 kb ****************************************************************/