Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. n = int(input())
  2. lista = []
  3. def tribonacci(x):   #Ciąg Tribonacciego
  4.  
  5.    a = 0
  6.    b = 1
  7.    c = 2
  8.  
  9.    lista2 = [0, 1, 2]
  10.    while c < x:
  11.        d = a + b + c
  12.        a = b
  13.        b = c
  14.        c = d
  15.        lista2.append(c)
  16.    return lista2
  17. if n < 0:
  18.    print("BLAD")
  19. else:
  20.     for i in range(0, n):
  21.         h = 0
  22.         if 0 <= n <= 1000000000000:
  23.             h = int(input())
  24.             lista.append(h)
  25.     x = max(lista)
  26.     tribonacci(x)
  27.     for i in range(0, n):
  28.         a = lista[i]
  29.         if a in tribonacci(x):
  30.             print(str(lista[i]) + '\t' + 'TAK')
  31.         elif a < 0:
  32.             print("BLAD")
  33.         else:
  34.             print(str(lista[i]) + '\t' + 'NIE')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement