fork download
  1. def startup():
  2. pi, ni = map(int, input().split(' '))
  3. if pi == 1:
  4. pyramidOne(ni)
  5. elif pi == 2:
  6. pyramidTwo(ni)
  7.  
  8. def pyramidOne(n):
  9. i = 0
  10. for x in range(1,n+1):
  11. if i == 0 and x == 1:
  12. if i !=1:
  13. i = i + 1
  14. if i>0 and i<=2 and x<=4:
  15. if i == 1 and x == 4:
  16. i = i + 1
  17. if i>1 and i<=3 and x<14:
  18. if i != 3 and x == 14:
  19. i = i + 1
  20. print(i)
  21. startup()
  22.  
  23. def pyramidTwo(n):
  24. i = 0
  25. for x in range(1,n+1):
  26. if i == 0 and x == 1:
  27. if i !=1:
  28. i = i +1
  29. if i>0 and i<=2 and x<=10:
  30. if i == 1 and x == 9:
  31. i = i + 1
  32. if i>1 and i<=3 and x<=35:
  33. if i != 3 and x == 35:
  34. i = i + 1
  35. print(i)
  36. startup()
  37. startup()
Runtime error #stdin #stdout #stderr 0.01s 27616KB
stdin
1 5
2 9
2 100
stdout
2
2
3
stderr
Traceback (most recent call last):
  File "./prog.py", line 37, in <module>
  File "./prog.py", line 4, in startup
  File "./prog.py", line 21, in pyramidOne
  File "./prog.py", line 6, in startup
  File "./prog.py", line 36, in pyramidTwo
  File "./prog.py", line 6, in startup
  File "./prog.py", line 36, in pyramidTwo
  File "./prog.py", line 2, in startup
EOFError: EOF when reading a line