Войти
или
Зарегистрироваться
Курсы
Учебник
Учебник 2.0
ОГЭ/ЕГЭ
Олимпиады
Рубрикатор
Компилятор
Статья Автор:
Печников Матвей
my_lib
#1 задача, файл 27-A(2).txt def zeros(k,m): n = k*m c = 0 while n % 10==0: c += 1 n //= 10 return c with open(input(),'r') as f: n = int(f.readline()) mas = [0 for _ in range(n)] for i in range(n): mas[i] = int(f.readline()) count = 0 for i in range(n): for j in range(i+1,n): if zeros(mas[i],mas[j]) == 6: count += 1 print(count)
×
#2 задача, файл 27-45792A.txt with open(input(),'r') as f: n = int(f.readline()) mas = [0 for _ in range(n)] for i in range(n): mas[i] = int(f.readline()) count = 0 for i in range(n): for j in range(i+1,n): if (mas[i]*mas[j]) % 2310 == 0 and (mas[i]+mas[j]) % 11 == 0: count += 1 print(count)
×
#3 задача, файл 27-45782A.txt with open(input(),'r') as f: n,k = map(int,f.readline().split()) mas = [0 for _ in range(n)] for i in range(n): mas[i] = int(f.readline()) ma = -1 for i in range(n-k): for j in range(i+k,n-k): x = sum(mas[i:i+k])+sum(mas[j:j+k]) if x % 68 == 0: ma = max(ma,x) print(ma)
×
#4 задача, файл 27-45784A.txt with open(input(), 'r') as f: n, k, m = map(int, f.readline().split()) homes = [list(map(int, x.split())) for x in f.readlines()] points = [] for i in range(n - 1): points += [point for point in range(homes[i][0]+m, homes[i+1][0]-m+1)] mi = float('inf') for i in points: cost = 0 for point, letters in homes: bags = letters // 20 + bool(letters % 20) dist = min(abs(point - i), k - abs(point - i)) cost += dist * bags mi = min(mi,cost) print(mi)
×
#5 задача, файл 27-45786A.txt with open(input(), 'r') as f: n, m = map(int, f.readline().split()) mass = [int(x) for x in f.readlines()] ans = 0 pref = [0 for _ in range(n+1)] for i in range(len(mass)): pref[i+1] = pref[i] + mass[i] for i in range(n): for j in range(i+1,n+1): if pref[j]-pref[i] <= m: ans = max(j-i,ans) print(ans)
×
#6 задача, файл 27-45788A.txt with open(input(), 'r') as f: n = int(f.readline()) mass = [int(x) for x in f.readlines()] ans,dist = 0,17 for i in range(n-2*dist): for j in range(i+dist,n-dist): for k in range(j+dist,n): if (mass[i]+mass[j]+mass[k]) % 7717 == 0: ans += 1 print(ans)
×
#7 задача, файл 27-45790A.txt with open(input(), 'r') as f: n = int(f.readline()) mass = [int(x) for x in f.readlines()] ans,dist = 0,25 for i in range(n-dist): for j in range(i+dist,n): if (mass[i]+mass[j]) % 4 == 0 and (mass[i]*mass[j]) % 9009 == 0: ans += 1 print(ans)
×
#8 задача, файл 27A_6638.txt with open(input(), 'r') as f: n = int(f.readline()) ants = [list(map(int, x.split())) for x in f.readlines()] mi,ans = float('inf'),-1 for lab, _ in ants: cost = 0 for ant,packs in ants: cost += abs(lab-ant) * packs if cost < mi: mi = cost ans = lab print(ans,mi)
×
Прикрепленные файлы
27-45782A.txt
27-45784A.txt
27-45786A.txt
27-45788A.txt
27-45790A.txt
27-45792A.txt
27-A(2).txt
27A_6638.txt
Чтобы оставить комментарий нужна авторизация
Печать