fork download
  1. import sys
  2. input=sys.stdin.readline
  3. ary=[0 for x in range(250)]
  4. ary[0]=1
  5. ary[1]=3
  6. for i in range(2,250):
  7. ary[i]=ary[i-1]+(ary[i-2]*2)
  8. while True:
  9. n=int(input())
  10. if n==0:
  11. print(0)
  12. else:
  13. print(ary[n-1])
  14.  
Runtime error #stdin #stdout #stderr 0.15s 23748KB
stdin
2
8
12
100
200
stdout
3
171
2731
845100400152152934331135470251
1071292029505993517027974728227441735014801995855195223534251
stderr
Traceback (most recent call last):
  File "./prog.py", line 9, in <module>
ValueError: invalid literal for int() with base 10: ''