Войти
или
Зарегистрироваться
Курсы
Учебник
Учебник 2.0
ОГЭ/ЕГЭ
Олимпиады
Рубрикатор
Компилятор
Статья Автор:
Стрелков Максим
сал
#1 # ВВОД a = [] with open('27-A.txt') as file: a = [int(num) for num in file.readlines()] n = a[0] a = a[1:] # ОБРАБОТКА ans = 0 for i in range(n): for j in range(i + 1, n): if (a[i] * a[j]) % 10**6 == 0 and (a[i] * a[j]) % 10**7 != 0: ans += 1 # ВЫВОД print(ans)
×
#2 # ВВОД a = [] with open('27-45792A.txt') as file: a = [int(num) for num in file.readlines()] n = a[0] a = a[1:] # ОБРАБОТКА ans = 0 for i in range(n): for j in range(i + 1, n): if (a[i] + a[j]) % 11 == 0 and (a[i] * a[j]) % 2310 == 0: ans += 1 # ВЫВОД print(ans)
×
#3 # ВВОД a = [] with open('27-45782A.txt') as file: n, k = map(int, file.readline().split()) a = [int(num) for num in file.readlines()] # ОБРАБОТКА ans = 0 for i in range(n): for j in range(i + k + 1, n): if (sum(a[i:i+k]) + sum(a[j:j+k])) % 68 == 0: ans = max(sum(a[i:i+k]) + sum(a[j:j+k]), ans) # ВЫВОД print(ans)
×
# 5 # ВВОД a = [] with open('27-45786A.txt', 'r') as f: n, m = map(int, f.readline().split()) a = [int(i) for i in f.readlines()] ans = -float('inf') # ОБРАБОТКА for i in range(n): ind = i s = 0 while s <= m: if ind + 1 >= n: break s += a[ind] if s < m: ind += 1 ans = max(ans, ind - i) # ВЫВОД print(ans)
×
# 4 # ВВОД with open('27-45784A.txt', 'r') as f: n, k, m = map(int, f.readline().split()) a = [list(map(int, f.readline().split())) for i in range(n)] # ОБРАБОТКА ans = float('inf') for pos in range(1, k + 1): dist = [float('inf')] * n for i in range(n): dist[i] = min(abs(a[i][0] - pos), abs(k + a[i][0] - pos)) f = True for i in range(n): if dist[i] < m: f = False break if not f: continue curr = 0 for i in range(n): curr += dist[i] * (a[i][1] // 20 + (a[i][1] % 20 != 0)) ans = min(ans, curr) # ВЫВОД print(ans)
×
# 6 # ВВОД with open('27-45788A.txt', 'r') as f: n = int(f.readline()) a = [int(i) % 7717 for i in f.readlines()] # ОБРАБОТКА ans = 0 for i in range(n): for j in range(i + 17, n): ans += a[j + 17:].count((2 * 7717 - a[i] - a[j]) % 7717) # ВЫВОД print(ans)
×
# 7 # ВВОД with open('27-45790A.txt', 'r') as f: n = int(f.readline()) a = [int(num) for num in f.readlines()] # ОБРАБОТКА ans = 0 for i in range(n): for j in range(i + 25, n): ans += ((a[i] + a[j]) % 4 == 0) and (a[i] * a[j] % 9009 == 0) # ВЫВОД print(ans)
×
# 8 # ВВОД with open('27A_6638.txt', 'r') as f: n = int(f.readline()) a = [list(map(int, i.split())) for i in f.readlines()] # ОБРАБОТКА ind = 0 ans = float('inf') for i in range(n): s = 0 for j in range(n): s += abs(a[i][0] - a[j][0]) * a[j][1] if ans > s: ans = s ind = a[i][0] # ВЫВОД print(ind, ans)
×
Чтобы оставить комментарий нужна авторизация
Печать