diff options
author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2020-06-06 21:33:13 +0700 |
---|---|---|
committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2020-06-06 21:33:13 +0700 |
commit | 2f674dc80f0382f1c3178f435714960734dc9d3c (patch) | |
tree | 2abba7e4ec72bd16f58f7375126144d3fd9f4bca /2ndary/09/Q-Huế-2014/bai2.pas | |
parent | b2d80610db6beda38573890ed169815e495bc663 (diff) | |
download | cp-2f674dc80f0382f1c3178f435714960734dc9d3c.tar.gz |
Reorganize stuff from secondary school
Diffstat (limited to '2ndary/09/Q-Huế-2014/bai2.pas')
-rw-r--r-- | 2ndary/09/Q-Huế-2014/bai2.pas | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/2ndary/09/Q-Huế-2014/bai2.pas b/2ndary/09/Q-Huế-2014/bai2.pas new file mode 100644 index 0000000..172137d --- /dev/null +++ b/2ndary/09/Q-Huế-2014/bai2.pas @@ -0,0 +1,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. |