about summary refs log tree commit diff
path: root/others/other/prodig.go
diff options
context:
space:
mode:
authorRaphael McSinyx <vn.mcsinyx@gmail.com>2017-08-02 10:44:26 +0700
committerRaphael McSinyx <vn.mcsinyx@gmail.com>2017-08-02 10:44:26 +0700
commit44f9d4b8e63d4f7f1b447744124e95f22c8ce296 (patch)
treebbeb1869e269819722ed1b3d82050c03d31e9d9f /others/other/prodig.go
parent03592e34c45c0ee5d8a3d82e76b4361813fcba7a (diff)
downloadcp-44f9d4b8e63d4f7f1b447744124e95f22c8ce296.tar.gz
Add others/other/{colorec.pas,gc.go,prodig.go}
Diffstat (limited to 'others/other/prodig.go')
-rw-r--r--others/other/prodig.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/others/other/prodig.go b/others/other/prodig.go
new file mode 100644
index 0000000..e269ee1
--- /dev/null
+++ b/others/other/prodig.go
@@ -0,0 +1,23 @@
+package main
+
+import "fmt"
+
+func main() {
+	var T, N int
+	fmt.Scan(&T)
+	for ; T > 0; T-- {
+		var s string
+		fmt.Scan(&N)
+		for i := 9; i > 1; i-- {
+			for N%i == 0 {
+				N /= i
+				s = fmt.Sprint(i) + s
+			}
+		}
+		if len(s) > 0 {
+			println(s)
+		} else {
+			println(1)
+		}
+	}
+}