Войти
или
Зарегистрироваться
Курсы
Учебник
Учебник 2.0
ОГЭ/ЕГЭ
Олимпиады
Рубрикатор
Компилятор
Статья Автор:
Герасименко Фёдор
27-ое задание
#1 f = open("27-A(2).txt", 'r') n = int(f.readline()) nums = [] for i in range(n): nums.append(int(f.readline())) f.close() ans = 0 for i in range(n): for j in range(i + 1, n): mult = nums[i] * nums[j] if mult % (10 ** 6) == 0 and mult % (10 ** 7) != 0: ans += 1 print(ans)
×
#2 f = open("27-45792A.txt", 'r') n = int(f.readline()) nums = [] for i in range(n): nums.append(int(f.readline())) f.close() ans = 0 for i in range(n): for j in range(i + 1, n): mult = nums[i] * nums[j] summ = nums[i] + nums[j] if summ % 11 == 0 and mult % 2310 == 0: ans += 1 print(ans)
×
#3 f = open('27-45782A.txt') n, k = map(int, f.readline().split()) nums = [] for i in range(n): nums.append(int(f.readline())) f.close() ans = 0 for i in range(n): for j in range(i + 2 * k, n + 1): leftsum = sum(nums[i : i + k]) rightsum = sum(nums[j - k : j]) allsum = leftsum + rightsum if allsum % 68 == 0: ans = max(ans, allsum) print(ans)
×
#5 f = open('27-45786A.txt') n, m = map(int, f.readline().split()) a = [int(f.readline()) for x in range(n)] f.close() ans = 0 for l in range(0, n): for r in range(l + 1, n + 1): s = sum(a[l : r]) if s > m: break ans = max(ans, r - l) print(ans)
×
#6 f = open('27-45788A.txt') n = int(f.readline()) a = [int(f.readline()) for i in range(n)] f.close() ans = 0 for i in range(0, n): for j in range(i + 17, n): for k in range(j + 17, n): ans += int((a[i] + a[j] + a[k]) % 7717 == 0) print(ans)
×
#7 f = open('27-45790A.txt') n = int(f.readline()) a = [int(f.readline()) for i in range(n)] f.close() ans = 0 for i in range(0, n): for j in range(i + 25, n): summ = a[i] + a[j] mult = a[i] * a[j] ans += int(summ % 4 == 0 and mult % 9009 == 0) print(ans)
×
#8 inf = 1000000007 f = open('27A_6638.txt') n = int(f.readline()) koord = [] packs = [] for i in range(n): a, b = map(int, f.readline().split()) koord.append(a) packs.append(b) f.close() summin = inf ans = -1 for i in range(n): summ = 0 for j in range(n): summ += packs[j] * abs(koord[j] - koord[i]) if summ < summin: summin = summ ans = koord[i] print(ans, summin)
×
#4 def Check(x, koord, m): for el in koord: if abs(el - x) < m: return 0 return 1 inf = 1000000007 f = open('27-45784A.txt') n, k, m = map(int, f.readline().split()) koord = [] letters = [] for i in range(n): a, b = map(int, f.readline().split()) koord.append(a) letters.append(b) f.close() summin = inf ans = -1 for i in range(k): if (Check(i, koord, m)): summ = 0 for j in range(n): summ += (letters[j] + 19) // 20 * min(abs(koord[j] - i), k - i + koord[j]) if summ < summin: summin = summ ans = i print(summin)
×
Чтобы оставить комментарий нужна авторизация
Печать