Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var n,i,j,x:longint;
- a,b:array[1..1000] of longint;
- z:array[0..1000] of real;
- zz,a1,a2:real;
- begin
- readln(n,x);
- z[0]:=1;
- for i:=1 to n do
- begin
- readln(a[i],b[i]);
- z[i]:=z[i-1]*a[i]/b[i];
- end;
- //for i:=1 to n do write(z[i]:0:2,' ');
- //writeln;
- for i:=1 to n do
- begin
- if z[i]=x then
- begin
- writeln(1,' ',i,' ');
- exit;
- end;
- for j:=2 to i do
- begin
- a1:=z[i]/z[j-1];
- if j<>i then
- begin
- zz:=a1;
- if zz=x then
- begin
- writeln(j,' ',i);
- exit;
- end;
- end;
- end;
- end;
- writeln('0 0');
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement