George_Zagorsky_1

qwdbjqwhbdqwd

Apr 9th, 2022 (edited)
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | None | 0 0
  1. from math import sqrt
  2.  
  3.  
  4. def permute(s):
  5.     result = [[s]]
  6.     for i in range(1, len(s)):
  7.         first = [s[:i]]
  8.         rest = s[i:]
  9.         for p in permute(rest):
  10.             result.append(first + p)
  11.     return result
  12.  
  13.  
  14. stack = tuple([
  15.     1, 1, 2, 3,
  16.     5, 8, 13, 21, 34,
  17.     55, 89, 144, 233, 377,
  18.     610, 987, 1597, 2584, 4181,
  19.     6765, 10946, 17711, 28657, 46368,
  20.     75025, 121393, 196418, 317811, 514229,
  21.     832040, 1346269, 2178309, 3524578, 5702887,
  22.     9227465, 14930352, 24157817, 39088169, 63245986,
  23.     102334155, 165580141, 267914296, 433494437, 701408733,
  24.     1134903170, 1836311903, 2971215073, 4807526976, 7778742049,
  25.     12586269025, 20365011074, 32951280099, 53316291173, 86267571272,
  26.     139583862445, 225851433717, 365435296162, 591286729879, 956722026041,
  27.     1548008755920, 2504730781961, 4052739537881, 6557470319842, 10610209857723,
  28.     17167680177565, 27777890035288, 44945570212853, 72723460248141, 117669030460994
  29. ])
  30.  
  31. x_c = 0
  32. for i in range(int(input())):
  33.     result = 0
  34.     for j in range(int(input()) + 1):
  35.         counter = True
  36.         string = str(j)
  37.         for el in string:
  38.             if el in ['1', '2', '3', '5', '8']:
  39.                 counter = False
  40.                 break
  41.  
  42.         if counter == True:
  43.             result += 1
  44.  
  45.     print(result)
  46.  
Add Comment
Please, Sign In to add comment