Advertisement
MadCortez

Untitled

Oct 3rd, 2020
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.76 KB | None | 0 0
  1. var n,i,j,x:longint;
  2. a,b:array[1..1000] of longint;
  3. z:array[0..1000] of real;
  4. zz,a1,a2:real;
  5.   begin
  6.     readln(n,x);
  7.     z[0]:=1;
  8.     for i:=1 to n do
  9.     begin
  10.       readln(a[i],b[i]);
  11.       z[i]:=z[i-1]*a[i]/b[i];
  12.     end;
  13.     //for i:=1 to n do write(z[i]:0:2,' ');
  14.     //writeln;
  15.     for i:=1 to n do
  16.       begin
  17.          if z[i]=x then
  18.          begin
  19.             writeln(1,' ',i,' ');
  20.             exit;
  21.          end;
  22.          for j:=2 to i do
  23.          begin
  24.             a1:=z[i]/z[j-1];
  25.            if j<>i then
  26.            begin
  27.              zz:=a1;
  28.              if zz=x then
  29.              begin
  30.                writeln(j,' ',i);
  31.                exit;
  32.              end;
  33.              end;
  34.              end;
  35.       end;
  36.     writeln('0 0');
  37.   end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement