about summary refs log tree commit diff
path: root/others/other/bin.pas
diff options
context:
space:
mode:
authorRaphael McSinyx <vn.mcsinyx@gmail.com>2017-01-10 21:30:06 +0700
committerRaphael McSinyx <vn.mcsinyx@gmail.com>2017-01-10 21:35:08 +0700
commit7c9b47ab9149d292d5493c865dfb8742a7450472 (patch)
treec2b8d9759740b02b9dc157b84f32c2860369bf3b /others/other/bin.pas
parentf4f486fb4b37b72ca345f95881e44043c728b2c3 (diff)
downloadcp-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.pas24
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.