Python组第47场题解
哈哈python菜🐔第一次ak(全模拟题)
AcWing 4399. 数字母
ls = []
for i in list(input()):
if i.isalpha(): ls.append(i)
print(len(set(ls)))
AcWing 4400. 玩游戏
n, k = list(map(int, input().split()))
ak = list(map(int, input().split()))
people = [i for i in range(n)]
idx = 0
for iters in range(k):
idx = (idx + ak[iters]) % len(people)
print(people.pop(idx)+1, end=' ')
AcWing 4401. 找回数组
N = int(input())
An = [0] + list(map(int, input().split()))
Xnk = []
for i in range(1, N+1):
Xnk.append(str(An[i]-An[i-1]))
res = []
for idx in range(1, N+1):
basic = Xnk[0:idx]
flag = True
for j in range(idx, N, idx):
if j+idx <= N:
if basic == Xnk[j:j+idx]: continue
else: flag = False; break
elif j+idx > N:
if basic[0:N-j] == Xnk[j:N]: continue
else: flag = False; break
if flag:
res.append(idx)
print(len(res))
print(*res)
你一定能获得更多的AK的!
为你打气!
加油!