about summary refs log tree commit diff
path: root/codechef/chfm.py
diff options
context:
space:
mode:
Diffstat (limited to 'codechef/chfm.py')
-rwxr-xr-xcodechef/chfm.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/codechef/chfm.py b/codechef/chfm.py
new file mode 100755
index 0000000..99b3d99
--- /dev/null
+++ b/codechef/chfm.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+for _ in range(int(input())):
+    input()
+    a = [int(i) for i in input().split()]
+    d, m = divmod(sum(a), len(a))
+    if m:
+        print('Impossible')
+        continue
+    try:
+        print(a.index(d) + 1)
+    except ValueError:
+        print('Impossible')