米哈游图像笔试
# ab变换串 8.7% t = int(input()) for _ in range(t): s = input() a = list(s) if s.count('a') != s.count('b'): print('NO') else: i = 0 while len(a) != 0 and i < len(a)-1: if a[i] == 'a' and a[i+1] == 'b': a.remove(a[i]) a.remove(a[i]) i = 0 else: i += 1 if len(a) == 0: print('YES') else: print('NO')
# 周期数组 100% n = int(input()) num = list(map(int, input().split())) ans = 0 if n == 2: print(ans) else: ji = [num[i] for i in range(0,n,2)] ou = [num[j] for j in range(1,n,2)] cishu1 = cishu2 = 0 jiset = ouset = set() for ii in ji: jiset.add(ii) for jj in ou: ouset.add(jj) for k in jiset: cishu1 = max(cishu1,ji.count(k)) for w in ouset: cishu2 = max(cishu2,ou.count(w)) ans = n - cishu1 - cishu2 print(ans)第三题,简单排雷,不会
#米哈游笔试##米哈游##笔经#