fork download
  1.  
  2. import java.util.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main(String[] args) {
  9. int startSum = 1;
  10. int years = 1;
  11. int k = 1;
  12. int currentSum = startSum;
  13.  
  14. Scanner scanner = new Scanner(System.in);
  15. int sum = scanner.nextInt();
  16. while (currentSum < sum){
  17. years++;
  18. k = k*2 + years;
  19. currentSum += k;
  20. }
  21. System.out.println(years);
  22. }
  23. }
Success #stdin #stdout 0.14s 321280KB
stdin
448
stdout
7