Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1.  
  2. ILE_LICZB = int(input("Wpisz ile ma byc wpisanych liczb: "))
  3.  
  4. if ILE_LICZB < 0:
  5. print("BLAD")
  6.  
  7. memory = {0: 0, 1: 1, 2: 2}
  8.  
  9. def tribo(n):
  10.  
  11.  
  12. if not n in memory:
  13. memory[n] = tribo(n - 1) + tribo(n - 2) + tribo(n - 3)
  14. return memory[n]
  15.  
  16. for _ in range(ILE_LICZB):
  17.  
  18. n = int(input())
  19.  
  20. if n <= 0 or n >= 1000000000000:
  21. print(str("BLAD"))
  22. elif n == tribo(n):
  23. print(str(n) + '\tTAK')
  24. else:
  25. print(str(n) + '\tNIE')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement