We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
run time error
LOL
a, b, k = int(input()), int(input()), int(input())
n = 2
sum1 = a + b
while n < 2 * (10 ** 6):
n += 1
q = list(str(sum1))
isthere=True
if (len(q) >= k):
for i in range(1, k+1):
if (((str(i) not in q[0:k])) or ((str(i) not in q[-k:]))):
isthere=False
break
if(isthere):
print(n)
break
a = b
b = sum1
sum1 += a
if (n == 2 * (10 ** 6) - 1):
print("no solution")
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #104: Pandigital Fibonacci ends
You are viewing a single comment's thread. Return to all comments →
run time error LOL a, b, k = int(input()), int(input()), int(input()) n = 2 sum1 = a + b while n < 2 * (10 ** 6): n += 1 q = list(str(sum1))
if (n == 2 * (10 ** 6) - 1): print("no solution")