Войти
или
Зарегистрироваться
Курсы
Учебник
Учебник 2.0
ОГЭ/ЕГЭ
Олимпиады
Рубрикатор
Компилятор
Статья Автор:
Иутин Илья
перебор
#1 mas = [] with open(input(), 'r', encoding='utf-8') as file: n = int(file.readline()) for _ in range(n): mas.append(int(file.readline())) k = 0 for i in range(n): for j in range(i+1, n): p = mas[i] * mas[j] if p % 10**6 == 0 and p % 10**7 != 0: k += 1 print(k)
×
#2 mas = [] with open(input(), 'r', encoding='utf-8') as file: n = int(file.readline()) for _ in range(n): mas.append(int(file.readline())) k = 0 for i in range(n): for j in range(i+1, n): if (mas[i] + mas[j]) % 11 == 0 and (mas[i] * mas[j]) % 2310 == 0: k += 1 print(k)
×
#8 mas = [] with open(input(), 'r', encoding='utf-8') as file: n = int(file.readline()) for _ in range(n): mas.append(list(map(int, file.readline()[:-1].split()))) c = 0 k = 0 mn = 10**10 for i in range(n): for j in range(n): c += abs(mas[j][0] - mas[i][0]) * mas[j][1] if c < mn: mn = c k = mas[i][0] c = 0 print(k, mn)
×
#3 mas = [] with open(input(), 'r', encoding='utf-8') as file: n, k = map(int, file.readline().split()) for _ in range(n): mas.append(int(file.readline())) sm = 0 for i in range(n - 2 * k): s = 0 s = sum(mas[i : i + k]) for j in range(i + 2 * k, n): s1 = sum(mas[j - k + 1: j + 1]) if (s + s1) % 68 == 0 and s + s1 > sm: sm = s + s1 print(sm)
×
Чтобы оставить комментарий нужна авторизация
Печать