about summary refs log tree commit diff
path: root/others/153x/030.py
diff options
context:
space:
mode:
Diffstat (limited to 'others/153x/030.py')
-rwxr-xr-xothers/153x/030.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/others/153x/030.py b/others/153x/030.py
new file mode 100755
index 0000000..f08d0d0
--- /dev/null
+++ b/others/153x/030.py
@@ -0,0 +1,19 @@
+#!/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)