We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 998d1b3 commit 34ff5a5Copy full SHA for 34ff5a5
ABC/ABC006/A.py
@@ -0,0 +1,7 @@
1
+N = input()
2
+if '3' in list(N):
3
+ print('YES')
4
+elif int(N)%3 ==0:
5
6
+else:
7
+ print('NO')
ABC/ABC006/B.py
@@ -0,0 +1,27 @@
+#pypy
+Sequence = [float('inf') for _ in range(1000000+1)]
+Sequence[0] = 0
+Sequence[1] = 0
+Sequence[2] = 0
+Sequence[3] = 1
+
8
+def tribonacci(n):
9
+ if Sequence[n] != float('inf'):
10
+ return Sequence[n]
11
+ return tribonacci(n-1) + tribonacci(n-2) + tribonacci(n-3)
12
13
+def tribonacci_h(n):
14
+ if n == 1:
15
+ return 0
16
+ elif n ==2:
17
18
+ elif n ==3:
19
+ return 1
20
21
+ for i in range(4, n+1):
22
+ Sequence[i] = (Sequence[i-3] + Sequence[i-2] + Sequence[i-1])%10007
23
24
25
26
+n = int(input())
27
+print(tribonacci_h(n)%10007)
0 commit comments