Advertisement
Guest User

Untitled

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