Войти
или
Зарегистрироваться
Курсы
Учебник
Учебник 2.0
ОГЭ/ЕГЭ
Олимпиады
Рубрикатор
Компилятор
Статья Автор:
Карпенко Иван
со
#1 a = [] with open('27-A(2).txt', 'r') as f: a = [int(num) for num in f.readlines()] n = a [0] a = a[1:] k = 0 for i in range(n): for j in range(i + 1, n): ch = a[i] * a[j] k += ch % 10 ** 6 == 0 and ch % 10 ** 7 != 0 print(k)
×
a = [] with open('27-45792A.txt', 'r') as f: a = [int(num) for num in f.readlines()] n = a [0] a = a[1:] k = 0 for i in range(n): for j in range(i + 1, n): x, y = a[i] , a[j] k += x % 11 == 0 and y % 11 == 0 and x * y % 210 == 0 print(k)
×
a = [] n = k = 0 with open('27-45782A.txt', 'r') as f: n, k = map(int, f.readline().split()) a = [int(num) for num in f.readlines()] mx = -float('inf') for i in range(n): for j in range(i + k + 1, n): sm = sum(a[i:i + k]) + sum(a[j:j + k]) if sm % 68 == 0: mx = max(mx, sm) print(mx)
×
#5 a = [] n = k = 0 with open('27-45786A.txt', 'r') as f: n, m = map(int, f.readline().split()) a = [int(num) for num in f.readlines()] mx = -float('inf') print(a) for st in range(n): ind = st sm = 0 while sm <= m: if ind + 1 >= n: break sm += a[ind] if sm < m: ind += 1 print(sm, ind) mx = max(ind - st, mx) print(mx)
×
#6 a = [] n = 0 kont = 0 with open('27-45788A.txt', 'r') as f: n = int(f.readline()) a = [int(num) % 7717 for num in f.readlines()] print(n, a) for i in range(n): for j in range(i + 17, n): kont += a[j + 17:].count((2 * 7717 - a[i] - a[j]) % 7717) print(kont)
×
#7 a = [] n = 0 kont = 0 with open('27-45790A.txt', 'r') as f: n = int(f.readline()) a = [int(num) for num in f.readlines()] print(n, a) for i in range(n): for j in range(i + 25, n): x, y = a[i], a[j] kont += ((x + y) % 4 == 0) and (x * y % 9009 == 0) print(kont)
×
#8 a = [] n = 0 def func(pos): summ = 0 for i in range(n): ind = a[i][0] cost = a[i][1] summ += abs(pos - ind) * cost return summ with open('27A_6638.txt', 'r') as f: n = int(f.readline()) a = [list(map(int, num.split())) for num in f.readlines()] mnpos = 0 mncost = float('inf') print(a) for pos in range(n): cost = func(a[pos][0]) if mncost > cost: mncost = cost mnpos = a[pos][0] print(mnpos, mncost)
×
#4 a = [] n = k = m = 0 def func(pos): summ = 0 f = True for i in range(n): ind = a[i][0] cost = a[i][1] if min(abs(pos - ind), abs(k - pos + ind)) < m: f = False break summ += min(abs(pos - ind), abs(k - pos + ind)) * (cost // 20 + 1 * (cost % 20 != 0)) if pos == 18: print(min(abs(pos - ind), abs(k - pos + ind)) * (cost // 20), end = ' ') return summ if f else float('inf') with open('27-45784A.txt', 'r') as f: n, k, m = map(int, f.readline().split()) a = [list(map(int, num.split())) for num in f.readlines()] mnpos = 0 mncost = float('inf') print(n, k, m, '\n', a) for pos in range(k): mncost = min(mncost, func(pos)) print(pos, func(pos)) print(mncost)
×
Чтобы оставить комментарий нужна авторизация
Печать