Все задачи на 5.10.17 13:00

This commit is contained in:
2017-10-05 13:08:02 +03:00
parent 93746b05d7
commit ca2ca71f63
120 changed files with 2343 additions and 0 deletions

41
uts/session_py/3.py Normal file
View File

@@ -0,0 +1,41 @@
import sys
problem_name = str('calendar')
sys.stdin = open(problem_name + ".in", "r")
# sys.stdout = open(problem_name+".out", "w")
def get_mass(num):
arr = []
n = num
while n > 0:
arr.append(n%10)
n = n//10
return arr
def bad_char(start, end, bad):
counterr = 0
for day in range(start, end):
an = get_mass(day)
for nu in num:
if nu in an:
counterr += 1
return counterr
n, k = map(int, input().split())
a = list(map(int, input().split()))
num = list(map(int, input().split()))
print(n,' ',k)
counter = 0
a.sort()
print(a)
lastmas = 0
lastcount = 0
for mounth in a:
if lastmas == mounth:
counter = counter + lastcount
else:
counter = counter + lastcount + lastcount + bad_char(lastmas, mounth, num)
lastmas = mounth
print(counter)