diff options
author | Nguyễn Gia Phong <vn.mcsinyx@gmail.com> | 2018-10-20 11:27:47 +0700 |
---|---|---|
committer | Nguyễn Gia Phong <vn.mcsinyx@gmail.com> | 2018-10-20 11:27:47 +0700 |
commit | 4c5ed94087a691ce47882786aea64f7b5bf3c130 (patch) | |
tree | 6ebb9374e9c9e1d867659a1de166fbe8f6481b19 /codechef/teammate.py | |
parent | 662168dbd56cbeba35bea782d580b0f7cc9a3ac2 (diff) | |
download | cp-4c5ed94087a691ce47882786aea64f7b5bf3c130.tar.gz |
Bon appétit
Diffstat (limited to 'codechef/teammate.py')
-rw-r--r-- | codechef/teammate.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/codechef/teammate.py b/codechef/teammate.py new file mode 100644 index 0000000..cc3846e --- /dev/null +++ b/codechef/teammate.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +from collections import defaultdict + +for _ in range(int(input())): + n = int(input()) + s = map(int, input().split()) + d = defaultdict(int) + for i in s: d[i] += 1 + result = 0 + for value in s.values(): + if value % 2: + pass + else: + result += value * (value-1) // 2 |