题目:
代码:
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the sockMerchant function below.
def sockMerchant(n, ar):
count = 0
ar.sort()
ar.append('*')
i = 0
while i<n:
if ar[i]==ar[i+1]:
count = count+1
i+=2
else:
i+=1
return count
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
n = int(input())
ar = list(map(int, input().rstrip().split()))
result = sockMerchant(n, ar)
fptr.write(str(result) + '\n')
fptr.close()
如果觉得不错,就点赞关注留言~
谢谢各位捧场~