diff options
author | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2017-01-10 21:30:06 +0700 |
---|---|---|
committer | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2017-01-10 21:35:08 +0700 |
commit | 7c9b47ab9149d292d5493c865dfb8742a7450472 (patch) | |
tree | c2b8d9759740b02b9dc157b84f32c2860369bf3b /others/other/bin.pas | |
parent | f4f486fb4b37b72ca345f95881e44043c728b2c3 (diff) | |
download | cp-7c9b47ab9149d292d5493c865dfb8742a7450472.tar.gz |
others/other: Add {bin,game}.pas and move others/dict here
Diffstat (limited to 'others/other/bin.pas')
-rw-r--r-- | others/other/bin.pas | 24 |
1 files changed, 24 insertions, 0 deletions
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. |