about summary refs log tree commit diff
path: root/codechef
diff options
context:
space:
mode:
Diffstat (limited to 'codechef')
-rwxr-xr-xcodechef/brkbks.lua14
-rw-r--r--codechef/chfdora.c33
-rwxr-xr-xcodechef/dynamo.py7
3 files changed, 54 insertions, 0 deletions
diff --git a/codechef/brkbks.lua b/codechef/brkbks.lua
new file mode 100755
index 0000000..88dc15b
--- /dev/null
+++ b/codechef/brkbks.lua
@@ -0,0 +1,14 @@
+#!/usr/bin/env lua
+local read = io.read
+local print = print
+
+for t = 1, read('*n') do
+    local s, w1, w2, w3 = read('*n', '*n', '*n', '*n')
+    if w1 + w2 + w3 <= s then
+        print(1)
+    elseif w1 + w2 <= s or w2 + w3 <= s then
+        print(2)
+    else
+        print(3)
+    end
+end
diff --git a/codechef/chfdora.c b/codechef/chfdora.c
new file mode 100644
index 0000000..fc0dbf6
--- /dev/null
+++ b/codechef/chfdora.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+
+int min(int a, int b)
+{
+	return (a < b) ? a : b;
+}
+
+int main()
+{
+	int t, n, m;
+
+	scanf("%d", &t);
+	while (t--) {
+		scanf("%d %d", &n, &m);
+		size_t a[n][m];
+		for (int i = 0; i < n; ++i)
+			for (int j = 0; j < m; ++j)
+				scanf("%zu", a[i] + j);
+
+		size_t count = 0;
+		for (int i = 0; i < n; ++i)
+			for (int j = 0; j < m; ++j) {
+				int max = min(min(i, j), min(n-i, m-j)-1);
+				for (int k = 0;
+				     k <= max && a[i+k][j] == a[i-k][j]
+				              && a[i][j+k] == a[i][j-k];
+				     count++, ++k);
+			}
+		printf("%zu\n", count);
+	}
+
+	return 0;
+}
diff --git a/codechef/dynamo.py b/codechef/dynamo.py
new file mode 100755
index 0000000..429a604
--- /dev/null
+++ b/codechef/dynamo.py
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+for t in range(int(input())):
+    n = 10 ** int(input())
+    print(n*2 + int(input()), flush=True)
+    print(n - int(input()), flush=True)
+    print(n - int(input()), flush=True)
+    input()