about summary refs log tree commit diff
path: root/THT/B/QG-2016/trigrid.py
diff options
context:
space:
mode:
authorRaphael McSinyx <vn.mcsinyx@gmail.com>2016-10-31 22:21:50 +0700
committerRaphael McSinyx <vn.mcsinyx@gmail.com>2016-10-31 22:21:50 +0700
commit71a6e456b59171a681bccff7eeba9db7367bca37 (patch)
treee6f517c4b4109e13c9bb31df6c4c40185ad7ddf7 /THT/B/QG-2016/trigrid.py
parent250b7d75204bb18311f51d8b67164f9ad4cef9f2 (diff)
downloadcp-71a6e456b59171a681bccff7eeba9db7367bca37.tar.gz
Thêm đề Tin học trẻ Quốc gia 2016 Bảng B
Diffstat (limited to 'THT/B/QG-2016/trigrid.py')
-rwxr-xr-xTHT/B/QG-2016/trigrid.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/THT/B/QG-2016/trigrid.py b/THT/B/QG-2016/trigrid.py
new file mode 100755
index 0000000..ea33d07
--- /dev/null
+++ b/THT/B/QG-2016/trigrid.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+
+a = (4, 3, 5, 6, 111, 222, 3333, 4444, 55555, 666666, 7777777, 88888888,
+     999999999, 123456789123456789, 1000000000000000000)
+
+t = lambda n: n * (n + 2) * (n * 2 + 1) // 8 % 2016
+
+with open('TRIGRID.TXT', 'w') as f:
+    for i in a:
+        f.write("{}\n".format(t(i)))