Pagini recente » Cod sursa (job #635880) | Cod sursa (job #1732271) | Cod sursa (job #3283791) | Cod sursa (job #2178788) | Cod sursa (job #138064)
Cod sursa(job #138064)
program heavymetal;
{$APPTYPE CONSOLE}
uses
SysUtils;
type nr = record
a,b:longint;
end;
var c,i,j,n,m:integer;
fin,fout:text;
v:array [1..100000] of nr;
{*----------------------------*}
function cauta:boolean;
begin
cauta:=true;
for j:=1 to n do
if j<>i then
begin
if ((v[i].a>=v[j].a) and (v[i].b<=v[j].b)) then
begin
cauta:=false;
exit;
end;
end;
end;
{*-----------MAIN-------------*}
begin
assign(fin,'heavymetal.in'); reset(fin);
assign(fout,'heavymetal.out'); rewrite(fout);
readln(fin,n);
for i:=1 to n do readln(fin,v[i].a,v[i].b);
c:=0;
for i:=1 to n do
begin
if cauta then c:=c+v[i].b-v[i].a;
end;
writeln(fout,c);
close(fin);
close(fout);
end.