Pagini recente » Cod sursa (job #1513835) | Cod sursa (job #2011815) | Cod sursa (job #458843) | Cod sursa (job #1057346) | Cod sursa (job #137433)
Cod sursa(job #137433)
var r,n,m,c,t,i,max,nr:longint;
f,g:text;
begin
assign(f,'garaj.in');reset(f);
assign(g,'garaj.out');rewrite(g);
read(f,n,m);
nr:=n;
max:=0;
for i:=1 to n do begin
read(f,c,t);
if (c>1) and (t=1) then nr:=nr+1;
if c>max then max:=c;
while t<>0 do begin
r:=c mod t;
c:=t;
t:=r;
end;
if c=1 then nr:=nr-1;
end;
write(g,max,' ',nr);
close(f);
close(g);
end.