A
n=int(input())a,b=0,0
for i in range(n):x,y=map(int,input().split())a+=xb+=y
if a>b:print("Takahashi")
elif a<b:print("Aoki")
else:print("Draw")
B
A B C必须都连着放,且必须按照ABC的顺序
分别给ABC赋值,有小的出现在大的后边就不符合题意
str=input()f=0
res=0
for i in str:if i=='A':x=1elif i=='B':x=2elif i=='C':x=3if f<=x:f=xelse:res=1break
if res==0:print("Yes")
else:print("No")
C
每两个数都连着一条边,存入字典,依次输出,用前一个数来确定后一个数是什么
n=int(input())
a=[0]+list(map(int,input().split()))
d={}
idx=0
for i in range(1,n+1):if a[i] not in d:d[a[i]]=0d[a[i]]=i
x=-1
for _ in range(n):print(d[x],end=" ")x=d[x]
D
建一个横纵坐标都从1开始的二维数组
统计每一行每一列的前缀和,依次枚举长度为k的数组,且该数组里边没有x
h,w,k=map(int,input().split())a=[[]]
for i in range(h):a.append([0]+list(input()))
zz=max(h,w)
s=[0 for _ in range(zz+1)]
d=[0 for _ in range(zz+1)]
res=1000000000for i in range(1,h+1):for j in range(1,w+1):s[j]=s[j-1]+int(a[i][j]=='.')d[j]=d[j-1]+int(a[i][j]=='x')# print(s)# print(d)for j in range(k,w+1):if d[j]-d[j-k]>0:continueelse:res=min(res,s[j]-s[j-k])# print(res)
for i in range(1,w+1):for j in range(1,h+1):s[j]=s[j-1]+int(a[j][i]=='.')d[j]=d[j-1]+int(a[j][i]=='x')for j in range(k,h+1):if d[j]-d[j-k]>0:continueelse:res=min(res,s[j]-s[j-k])# print(res)
if res==1000000000:print("-1")
else:print(res)