Pagini recente » Cod sursa (job #1254556) | Cod sursa (job #311935) | Cod sursa (job #2240232) | Istoria paginii runda/musai_must/clasament | Cod sursa (job #161364)
Cod sursa(job #161364)
program p1;
uses wincrt;
var a,b:array[1..100] of integer;
f1,f2:text;
n,k,j,i,aux,max:integer;
begin
assign(f1,'carnati.in');
reset(f1);
readln(f1,n,k);
close(f1);
for i:=1 to n do
readln(f1,a[i],b[i]);
for i:=1 to n do
for j:=1 to n do
begin
aux:=0;
for k:=j to n do
if b[i]<=b[k] then
aux:=aux+b[i];
aux:=aux-k*(n-j+1);
if aux>max then
max:=aux;
end;
assign(f2,'carnati.out');
rewrite(f2);
writeln(f2,max);
end.