From 7c9b47ab9149d292d5493c865dfb8742a7450472 Mon Sep 17 00:00:00 2001 From: Raphael McSinyx Date: Tue, 10 Jan 2017 21:30:06 +0700 Subject: others/other: Add {bin,game}.pas and move others/dict here --- others/other/bin.pas | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 others/other/bin.pas (limited to 'others/other/bin.pas') diff --git a/others/other/bin.pas b/others/other/bin.pas new file mode 100644 index 0000000..8543eda --- /dev/null +++ b/others/other/bin.pas @@ -0,0 +1,24 @@ +var + f: text; + n: int64; + s: string = ''; + +begin + assign(f, 'BIN.INP'); + reset(f); + readln(f, n); + close(f); + + while n > 0 do + begin + s := chr(n mod 2 + 48) + s; + n := n shr 1 + end; + + writeln(s); + + assign(f, 'BIN.OUT'); + rewrite(f); + writeln(f, s); + close(f) +end. -- cgit 1.4.1