fork(1) download
  1. tab = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  2. while True:
  3. x = input()
  4. x = x.split()
  5. a = x[0] #z
  6. b = int(x[1]) #3
  7. c = int(x[2]) #6
  8. if a == 'z':
  9. tab[b] = c
  10. x = tab[b]
  11. elif a == '+':
  12. c = tab[b] + tab[c]
  13. print(int(c))
  14. elif a == '-':
  15. c = tab[b] - tab[c]
  16. print(int(c))
  17. elif a == '*':
  18. c = tab[b] * tab[c]
  19. print(int(c))
  20. elif a == '/':
  21. c = tab[b] / tab[c]
  22. print(int(c))
  23. elif a == '%':
  24. c = tab[b] % tab[c]
  25. print(int(c))
Runtime error #stdin #stdout #stderr 0.18s 23480KB
stdin
z 3 6
z 1 89
z 2 60
z 0 11
+ 0 1
- 1 2
* 2 3
/ 3 0
% 3 1
stdout
100
29
360
0
6
stderr
Traceback (most recent call last):
  File "./prog.py", line 3, in <module>
EOFError: EOF when reading a line