y, x = map(int, input().split()) #Размеры матрицы, если матрицы имеет квадратную форму, то просто y = x = int(input())
matrix = [list(map(int, input().split())) for i in range(y)] #Заполняем матрицу
ans = [sum(matrix[k][i] for k in range(y)) for i in range(x)] #Находим сумму каждого столбца
print(*ans) #Выводим эти суммы
P.S. Комментарии убери, иначе не будет работать
P.S.S. Версия без коментариев и пример работы:
y, x = map(int, input().split())
matrix = [list(map(int, input().split())) for i in range(y)]
ans = [sum(matrix[k][i] for k in range(y)) for i in range(x)]
print(*ans)
Ввод:
3 4 #Размер
3 4 5 6 #Матрица
1 2 3 4
1 1 1 1
Вывод:
5 7 9 11
program raf105;
var
people,time,o1,o2:integer;
begin
write('Сколько человек увидел василий: ');
readln(people);
while people<>0 do
time+= 1;
if people>0 then
if o1=10 then
people-=1;
o1:=0;
end;
o1+=1;
if (people>0) and (time>=5) then
if o2=10 then
o2:=0;
o2+=1;
time-=1;
if time<=720 then
writeln('Василию придётся простоять в очереди ',time div 60,' ч. ',time mod 60,' мин.')
else
writeln('Василия не обслужат сегодня');
end.
y, x = map(int, input().split()) #Размеры матрицы, если матрицы имеет квадратную форму, то просто y = x = int(input())
matrix = [list(map(int, input().split())) for i in range(y)] #Заполняем матрицу
ans = [sum(matrix[k][i] for k in range(y)) for i in range(x)] #Находим сумму каждого столбца
print(*ans) #Выводим эти суммы
P.S. Комментарии убери, иначе не будет работать
P.S.S. Версия без коментариев и пример работы:
y, x = map(int, input().split())
matrix = [list(map(int, input().split())) for i in range(y)]
ans = [sum(matrix[k][i] for k in range(y)) for i in range(x)]
print(*ans)
Ввод:
3 4 #Размер
3 4 5 6 #Матрица
1 2 3 4
1 1 1 1
Вывод:
5 7 9 11
program raf105;
var
people,time,o1,o2:integer;
begin
write('Сколько человек увидел василий: ');
readln(people);
while people<>0 do
begin
time+= 1;
if people>0 then
begin
if o1=10 then
begin
people-=1;
o1:=0;
end;
o1+=1;
end;
if (people>0) and (time>=5) then
begin
if o2=10 then
begin
people-=1;
o2:=0;
end;
o2+=1;
end;
end;
time-=1;
if time<=720 then
writeln('Василию придётся простоять в очереди ',time div 60,' ч. ',time mod 60,' мин.')
else
writeln('Василия не обслужат сегодня');
end.