about summary refs log tree commit diff
path: root/12/TP-ThanhHoá-2009/bai4.py
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2020-06-06 21:33:13 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2020-06-06 21:33:13 +0700
commit2f674dc80f0382f1c3178f435714960734dc9d3c (patch)
tree2abba7e4ec72bd16f58f7375126144d3fd9f4bca /12/TP-ThanhHoá-2009/bai4.py
parentb2d80610db6beda38573890ed169815e495bc663 (diff)
downloadcp-2f674dc80f0382f1c3178f435714960734dc9d3c.tar.gz
Reorganize stuff from secondary school
Diffstat (limited to '12/TP-ThanhHoá-2009/bai4.py')
-rw-r--r--12/TP-ThanhHoá-2009/bai4.py28
1 files changed, 0 insertions, 28 deletions
diff --git a/12/TP-ThanhHoá-2009/bai4.py b/12/TP-ThanhHoá-2009/bai4.py
deleted file mode 100644
index f5c5a26..0000000
--- a/12/TP-ThanhHoá-2009/bai4.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env python3
-
-
-def ops(number, length):
-    b = bin(number)[2:]
-    return '+' * (length - len(b)) + b.replace('0', '+').replace('1', '-')
-
-
-def libai4(n):
-    seq, l = list(range(1, n + 1)), []
-
-    for i in range(2 ** (n - 1)):
-        s = ''.join(["{}{}".format(*j) for j in zip(ops(i, n), seq)])[1:]
-        if eval(s) == 0:
-            l.append(s + '=0\n')
-
-    return l
-
-
-if __name__ == '__main__':
-    with open('BAI4.INP') as f:
-        n = int(f.read())
-
-    with open('BAI4.OUT', 'w') as f:
-        l = libai4(n)
-        f.write('{}\n'.format(len(l)))
-        for s in l:
-            f.write(s)