about summary refs log tree commit diff
path: root/codechef
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2019-02-13 20:48:02 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2019-02-13 20:48:28 +0700
commit477c426b55d168764a34873561f78b3c34b1f013 (patch)
tree30d0982d9b501b6c1a45ac73d9cc90bcbc750407 /codechef
parentce56bd193a7c8c6437443227cd3abb51134e3e7a (diff)
downloadcp-477c426b55d168764a34873561f78b3c34b1f013.tar.gz
A new project is coming
Diffstat (limited to 'codechef')
-rwxr-xr-xcodechef/chefing.py6
-rwxr-xr-xcodechef/depchef.py9
-rwxr-xr-xcodechef/hmappy2.p65
3 files changed, 20 insertions, 0 deletions
diff --git a/codechef/chefing.py b/codechef/chefing.py
new file mode 100755
index 0000000..e3c71a1
--- /dev/null
+++ b/codechef/chefing.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python3
+from functools import reduce
+from operator import and_
+
+for _ in range(int(input())):
+    print(len(reduce(and_, (set(input()) for _ in range(int(input()))))))
diff --git a/codechef/depchef.py b/codechef/depchef.py
new file mode 100755
index 0000000..e4899a1
--- /dev/null
+++ b/codechef/depchef.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python3
+for _ in range(int(input())):
+    input()
+    a, d = ([int(i) for i in input().split()] for _ in range(2))
+    a.extend((a[0], a[-1]))
+    try:
+        print(max(d for i, d in enumerate(d) if d > a[i-1] + a[i+1]))
+    except ValueError:
+        print(-1)
diff --git a/codechef/hmappy2.p6 b/codechef/hmappy2.p6
new file mode 100755
index 0000000..cfe4cf5
--- /dev/null
+++ b/codechef/hmappy2.p6
@@ -0,0 +1,5 @@
+#!/usr/bin/env perl6
+for ^get() {
+    my ($N, $A, $B, $K) = get.words.map: *.Int;
+    put $N div $A + $N div $B - $N div ($A lcm $B) * 2 < $K ?? 'Lose' !! 'Win';
+}