1712
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,4 @@
|
|||||||
.idea/
|
.idea/
|
||||||
output/
|
output/
|
||||||
|
venv
|
||||||
|
.venv
|
||||||
31
zeta_python/1562.py
Normal file
31
zeta_python/1562.py
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
N = int(input())
|
||||||
|
#3차원
|
||||||
|
temper = [0 for i in range(N)]
|
||||||
|
count = 0
|
||||||
|
|
||||||
|
def C(t):
|
||||||
|
T = [0 for i in range(10)]
|
||||||
|
for i in t:
|
||||||
|
T[i] = True
|
||||||
|
if all(T) is True:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def I(l, k):
|
||||||
|
global count
|
||||||
|
if 0 <= k <= 9:
|
||||||
|
temper[l - 1] = k
|
||||||
|
if l == 1:
|
||||||
|
if C(temper):
|
||||||
|
count += 1
|
||||||
|
count %= 1000000000
|
||||||
|
else:
|
||||||
|
I(l - 1, k - 1)
|
||||||
|
I(l - 1, k + 1)
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
for i in range(1,10):
|
||||||
|
I(N, i)
|
||||||
|
print(count % 1000000000)
|
||||||
20
zeta_python/completed/10844.py
Normal file
20
zeta_python/completed/10844.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
N = int(input())
|
||||||
|
|
||||||
|
Mem = [[0] * 10 for i in range(100)]
|
||||||
|
|
||||||
|
|
||||||
|
def I(l, k):
|
||||||
|
if 0 <= k <= 9:
|
||||||
|
if l == 1:
|
||||||
|
return 1
|
||||||
|
elif Mem[l-1][k] != 0:
|
||||||
|
return Mem[l-1][k]
|
||||||
|
else:
|
||||||
|
temp = (I(l - 1, k - 1) + I(l - 1, k + 1)) % 1000000000
|
||||||
|
Mem[l-1][k] = temp
|
||||||
|
return temp
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
print(sum(I(N, i) for i in range(1, 10)) % 1000000000)
|
||||||
2
zeta_python/completed/1712.py
Normal file
2
zeta_python/completed/1712.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
a,b,c = map(int, input().split())
|
||||||
|
print(int(a/(c-b)+1)) if c-b>0 else print(-1)
|
||||||
38
zeta_python/completed/2780.py
Normal file
38
zeta_python/completed/2780.py
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
Mem = [[0] * 10 for i in range(1000)]
|
||||||
|
|
||||||
|
|
||||||
|
def I(l, k):
|
||||||
|
if l == 1:
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
if Mem[l - 1][k] != 0:
|
||||||
|
return Mem[l - 1][k]
|
||||||
|
if k == 1:
|
||||||
|
temp = (I(l - 1, 2) + I(l - 1, 4)) % 1234567
|
||||||
|
elif k == 2:
|
||||||
|
temp = (I(l - 1, 1) + I(l - 1, 3) + I(l - 1, 5)) % 1234567
|
||||||
|
elif k == 3:
|
||||||
|
temp = (I(l - 1, 2) + I(l - 1, 6)) % 1234567
|
||||||
|
elif k == 4:
|
||||||
|
temp = (I(l - 1, 1) + I(l - 1, 5) + I(l - 1, 7)) % 1234567
|
||||||
|
elif k == 5:
|
||||||
|
temp = (I(l - 1, 2) + I(l - 1, 4) + I(l - 1, 6) + I(l - 1, 8)) % 1234567
|
||||||
|
elif k == 6:
|
||||||
|
temp = (I(l - 1, 3) + I(l - 1, 5) + I(l - 1, 9)) % 1234567
|
||||||
|
elif k == 7:
|
||||||
|
temp = (I(l - 1, 4) + I(l - 1, 8) + I(l - 1, 0)) % 1234567
|
||||||
|
elif k == 8:
|
||||||
|
temp = (I(l - 1, 5) + I(l - 1, 7) + I(l - 1, 9)) % 1234567
|
||||||
|
elif k == 9:
|
||||||
|
temp = (I(l - 1, 6) + I(l - 1, 8)) % 1234567
|
||||||
|
elif k == 0:
|
||||||
|
temp = (I(l - 1, 7)) % 1234567
|
||||||
|
Mem[l - 1][k] = temp
|
||||||
|
return temp
|
||||||
|
|
||||||
|
|
||||||
|
T = int(input())
|
||||||
|
Ns = [int(input()) for i in range(T)]
|
||||||
|
|
||||||
|
for n in Ns:
|
||||||
|
print(sum(I(n, i) for i in range(10))%1234567)
|
||||||
@@ -1,2 +1 @@
|
|||||||
5 21
|
12
|
||||||
1 3 5 9 10
|
|
||||||
Reference in New Issue
Block a user