about summary refs log tree commit diff
path: root/daily/285easy/2enc.py
diff options
context:
space:
mode:
Diffstat (limited to 'daily/285easy/2enc.py')
-rwxr-xr-xdaily/285easy/2enc.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/daily/285easy/2enc.py b/daily/285easy/2enc.py
new file mode 100755
index 0000000..1aeb15f
--- /dev/null
+++ b/daily/285easy/2enc.py
@@ -0,0 +1,7 @@
+#!/usr/bin/env python3
+
+enc = lambda n: ' '.join([str(i) for i in n // 255 * [255] + [n % 255]])
+
+with open('2enc.inp') as fi, open('2enc.out', 'w') as fo:
+    for line in fi:
+        fo.write(' '.join([enc(int(n)) for n in line.split()]) + '\n')