Разработать программу, которая на вход получает 4 числа (X Y R N). На экран выводится N квадратов с координатами X, X1, Y, Y1 на расстояние между квадратами K. В ПАСКАЛЕ
var a: array [1..100,1..100] of longint ;i, j ,d, n,m,k: longint;beginread(n,m); for i:=1 to n do for j:= 1 to m doread(a[i,j]); j:=0; for i:=1 to n do begin j:=j+1; d:=0; while d<2 do if a[i,j]<0 then begin k:=k+1; d:= 3; end; end;
if k>(m/2) then begin for i:= 1 to n do for j:= 1 to m do if a[i,j]<0 then a[i,j]:=a[i,j]*10 ; end else begin for i:=1 to n do for j:= 1 to m do if a[i,j]<0 then a[i,j]:=a[i,j]*a[i,j] ;end; for i:=1 to n dobegin for j:= 1 to m dowrite(a[i,j],' ');end;end.
for i:=1 to n do for j:= 1 to m doread(a[i,j]);
j:=0;
for i:=1 to n do begin j:=j+1; d:=0; while d<2 do if a[i,j]<0 then begin k:=k+1; d:= 3; end; end;
if k>(m/2) then begin for i:= 1 to n do for j:= 1 to m do if a[i,j]<0 then a[i,j]:=a[i,j]*10 ;
end
else
begin for i:=1 to n do for j:= 1 to m do if a[i,j]<0 then a[i,j]:=a[i,j]*a[i,j] ;end;
for i:=1 to n dobegin for j:= 1 to m dowrite(a[i,j],' ');end;end.
def rate_f(movies):
if len(dictionary[movies]) == 0:
return True
def film_in_dictionary(movies):
if movies in dictionary:
return True
else:
return False
def average(movies):
mean = 0
for key2 in dictionary[movies].keys():
mean += dictionary[movies][key2]
print(f'{movies} средняя оценка: {mean / len(dictionary[movies])}')
dictionary = {}
while True:
command = input('Введите команду: ')
if command != 'exit' and command != 'list' and command != 'add' and command != \
'delete' and command != 'rate' and command != 'find':
print('Error')
continue
if command == 'exit':
break
if command == 'list':
for key in dictionary.keys():
if rate_f(key):
print(f'{key} не оценивался')
else:
average(key)
continue
film = input('Введите название фильма: ')
if command == 'add':
if film_in_dictionary(film):
print('Error')
else:
dictionary[film] = {}
elif command == 'delete':
if film in dictionary:
del dictionary[film]
else:
print('Error')
elif command == 'rate':
name = input('Имя пользователя: ')
rate = float(input('Оценка: '))
if 0 < rate <= 10:
dictionary[film][name] = rate
else:
print('Error')
elif command == 'find':
if rate_f(film):
continue
for name, rate in dictionary[film].items():
print(f'{name} поставил оценку: {rate}')
average(film)