about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRaphael McSinyx <vn.mcsinyx@gmail.com>2017-01-21 21:34:57 +0700
committerRaphael McSinyx <vn.mcsinyx@gmail.com>2017-01-21 21:34:57 +0700
commitb7215be88c5ddfe4d2454f7d366bf4b2a952df2e (patch)
tree7bff4ece8415c9ad34ad9b20212bfe8065d553dc
parent5f2a005ffd5052902a0c62c1c4c8f90eb1011fc3 (diff)
downloadcp-b7215be88c5ddfe4d2454f7d366bf4b2a952df2e.tar.gz
others/153x: rm 030.py (inaccurate algorithm) and add 035.py
-rwxr-xr-xothers/153x/030.py19
-rwxr-xr-xothers/153x/035.py11
2 files changed, 11 insertions, 19 deletions
diff --git a/others/153x/030.py b/others/153x/030.py
deleted file mode 100755
index f08d0d0..0000000
--- a/others/153x/030.py
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env python3
-
-with open("CUT.INP") as f:
-    m, n = map(int, f.readline().split())
-
-squares = []
-while m - n:
-    if m > n:
-        m -= n
-        squares.append("{} 1 {}\n".format(m + 1, n))
-    else:
-        n -= m
-        squares.append("1 {} {}\n".format(n + 1, m))
-squares.append("1 1 {}\n".format(m))
-
-with open("CUT.OUT", "w") as f:
-    f.write("{}\n".format(len(squares)))
-    for i in squares:
-        f.write(i)
diff --git a/others/153x/035.py b/others/153x/035.py
new file mode 100755
index 0000000..1a428e7
--- /dev/null
+++ b/others/153x/035.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python3
+
+from itertools import permutations
+
+with open("PERMUTE.INP") as f:
+    l = sorted(set(permutations(f.readline().strip())))
+
+with open("PERMUTE.OUT", "w") as f:
+    f.write("{}\n".format(len(l)))
+    for i in l:
+        f.write("".join(i) + '\n')