We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1b3affc commit 6e2fb22Copy full SHA for 6e2fb22
project_euler/problem_234/sol1.py
@@ -0,0 +1,32 @@
1
+# https://projecteuler.net/problem=234
2
+def fib(a, b, n):
3
+
4
+ if n==1:
5
+ return a
6
+ elif n==2:
7
+ return b
8
+ elif n==3:
9
+ return str(a)+str(b)
10
11
+ temp = 0
12
+ for x in range(2,n):
13
+ c=str(a) + str(b)
14
+ temp = b
15
+ b = c
16
+ a = temp
17
+ return c
18
19
20
+q=int(input())
21
+for x in range(q):
22
+ l=[i for i in input().split()]
23
+ c1=0
24
+ c2=1
25
+ while(1):
26
27
+ if len(fib(l[0],l[1],c2))<int(l[2]):
28
+ c2+=1
29
+ else:
30
+ break
31
+ print(fib(l[0],l[1],c2+1)[int(l[2])-1])
32
0 commit comments