gears_count = int(input())
connections_count = int(input())
connections = []
for i in range(connections_count):
inp = input()
connections = connections + [[int(inp.split()[0]), int(inp.split()[1])]]
def get_connections_of_gear(gear=1, connections_arr=[[0]]):
gear_connections = 0
if connections_arr:
for i in range(connections_count * 2):
if connections_arr[i // 2][i % 2] == gear:
gear_connections += 1
return gear_connections
def is_valid():
if gears_count < 3 or connections_count < 3:
return "good"
elif gears_count % 2 == 0:
gears = 0
for i in range(gears_count):
if get_connections_of_gear(i, connections) > 2:
gears += 1
if gears % 2 == 0:
return "good"
elif not gears_count % 2 == 0:
gears = 0
for i in range(gears_count):
if get_connections_of_gear(i, connections) > 2:
gears += 1
if not gears % 2 == 0:
return "good"
return "bad"
print(is_valid())
Объяснение:
8 из 11
a : array[1..10] of word;
max : word;
begin
randomize;
for I : byte := 1 to 10 do
a[i] := random(1, 60000);
max := 0;
for I : byte := 1 to 10 do
if a[i] > max then max := a[i];
writeln(max*3);
end.
Добавлю и объяснение. Алгоритм заполняет целочисленный массив из десяти элементов случайными числами. Возможны диапазон числе: от 1 до 60000. Затем в следующем цикле выискивается максимальное число, которое выдал генератор случайных чисел. В строке writeln выводится значение этого числа умноженное на три.