diff options
author | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2016-11-01 11:31:39 +0700 |
---|---|---|
committer | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2016-11-01 11:31:39 +0700 |
commit | dfaf87f8696bb31bc1a29b2d4a67f17ad1a2f593 (patch) | |
tree | b2cced929ddfa488f8dd9d871aed35266fe43f47 /9/TP-Huế-2014/bai3.pas | |
parent | 71a6e456b59171a681bccff7eeba9db7367bca37 (diff) | |
download | cp-dfaf87f8696bb31bc1a29b2d4a67f17ad1a2f593.tar.gz |
Thêm đề HSG lớp 9 TP Huế
Diffstat (limited to '9/TP-Huế-2014/bai3.pas')
-rw-r--r-- | 9/TP-Huế-2014/bai3.pas | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/9/TP-Huế-2014/bai3.pas b/9/TP-Huế-2014/bai3.pas new file mode 100644 index 0000000..91fc05f --- /dev/null +++ b/9/TP-Huế-2014/bai3.pas @@ -0,0 +1,34 @@ +var + x, y: string; + f: text; + a: array[0 .. 9] of shortint; + b: shortint; + c: char; + +begin + assign(f, 'INPUT.INP'); + reset(f); + readln(f, x); + readln(f, y); + close(f); + + fillchar(a, 0, sizeof(a)); + + for c in x do + a[ord(c) - 48] := 1; + + for c in y do + begin + b := ord(c) - 48; + if a[b] = 1 then + a[b] := 2 + end; + + assign(f, 'OUTPUT.OUT'); + rewrite(f); + for b := 9 downto 0 do + if a[b] = 2 then + write(f, b); + writeln(f); + close(f) +end. |