fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. long long n;
  6. cin >> n;
  7. long long d=0, s=0;
  8. while (s<n) {
  9. d++;
  10. s+=d*(d+1)/2;
  11. }
  12. cout << d<<endl;
  13. return 0;
  14. }
Success #stdin #stdout 0s 5316KB
stdin
20
stdout
4