about summary refs log tree commit diff
path: root/2ndary/09/Q-Huế-2014/bai2.pas
blob: 172137d01d9184f9e615ee0bcefeda64b92def34 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var
  a, b, c, e, p, k, tmp: real;

function det(a, b, c, d: real): real;
  begin
    exit(a * d - b * c)
  end;

begin
  read(a, b, c, e, p, k);

  tmp := det(a, b, e, p);
  
  if tmp <> 0 then
    begin
      writeln('x = ', (det(c, b, k, p) / tmp):0:6);
      writeln('y = ', (det(a, c, e, k) / tmp):0:6);
      writeln('Hai đường thẳng cắt nhau.')
    end
  else if c <> k then
    begin
      writeln('Phương trình vô nghiệm.');
      writeln('Hai đường thẳng song song.')
    end
  else
    begin
      if a = 0 then
        writeln('y = ',  (c / b):0:6)
      else if b = 0 then
        writeln('x = ', (c / a):0:6)
      else
        writeln('x = ', (-b / a):0:6, 'y + ', (c / a):0:6);
      writeln('Hai đường thẳng trùng nhau.')
    end;
end.