s=input('请输入s:')
p=input(请输入p:')
scount=[0]*26
pcount=[0]*26
m=len(s)
n=len(p)
ans=[]
def pos(c):
if
return ord(c)-65
else:
return ord(c)-97
for i in range(n):
scount[pos(s[i])]+=1
pcount[pos(p[i])]+=1
if scount==pcount:
ans.append(0)
for i in range(m-n):
scount[pos(s[i])]-=1
scount[
if scount==pcount:
ans.append
print('同源词起点为:', ans, end=" ")
head, tail=0, 5
x=a[head]
head+=1
while(head+1) % len(a)! =tail:
t=y=a[head]
head=(head+1)%len(a)
if x<y:
x, y=y, x
if x%y!=0:
a[tail]=x%y
tail=(tail+1)%len(a)
x=t
print(a[head])
A.24 | B.12 | C.3 | D.0 |
n=len(s)
f=[1]*n
for i in range(n-1):
for j in range(i+1,n):
if s[j]>=s[i]:
f[j]+=1
else:
f[i]+=1
print(f)
A.数值越大名次值越大,同数值先出现的名次值小 |
B.数值越大名次值越大,同数值先出现的名次值大 |
C.数值越大名次值越小,同数值先出现的名次值小 |
D.数值越大名次值越小,同数值先出现的名次值大 |
图a
A.if trc>rl or tre<r2: flag=0 elif trc<=rl: flag=1 else: flag=2 | B.if not tre<=rl an dtre<r2: flag=0 elif trc<=rl: flag=1 else: flag=2 | C.if tre<=r1: flag=1 if trc>=r2: flag=2 else: flag=0 | D.flag=0 if trc<=r1: flag=1 if trc>=r2: flag=2 |
监测时间 | 余氯单位:mg/mL | PH值 | 浑浊度 | ![]() |
2023/7/22 08:00 | 0.58 | 7.3 | 1.7 | |
2023/7/22 08:05 | 0.58 | 7.3 | 2.0 | |
2023/7/22 08:10 | 0.59 | 7.6 | 2.2 | |
2023/7/22 08:15 | 0.58 | 7.9 | 2.4 | |
2023/7/22 08:20 | 0.57 | 7.2 | 2.2 | |
2023/7/22 19:49 | 0.59 | 7.6 | 3.0 | |
2023/7/22 19:54 | 0.53 | 7.7 | 3.4 | |
2023/7/22 19:59 | 0.56 | 7.9 | 2.3 | |
2023/7/22 20:04 | 0.60 | 7.7 | 2.0 |
图b 图c
df.at[i,′小时′]=str(df.at[i,′监测时间′])[11:13]
A.[’c’,’d’,’c’] | B.[’c’,’c’,’d’] |
C.[’c’,’’,’d’] | D.[’c’,’d’] |
图a 图b
tot=(m+1)*(n+1) #顶点总数
1st=[[ ] for i in range(tot)]
for i in range(tot):
if i > m:
1st[i].append(i-m-1)
if i<(m+1)*n:
1st[i] .append(i+m+1)
if i%(m+1)!=0:
1st[i].append(i-1)
if i%(m+1)!=m:
图c
if path[i] [0] =x:
cnt+= 1
s="最短路径"+str(cnt)+":"
v=path[i]
while
s=s+str(v[0])+","
v=path[v[2]]
s=s+str(v[0])+"。"
print(s)
请输入起点:0 请输入终点:10 最短路径1:0,1,2,6,10。 最短路径2:0,1,5,6,10。 最短路径3:0,4,5,6,10。 最短路径4:0,1,5,9,10。 最短路径5:0,4,5,9,10。 最短路径6:0,4,8,9,10。 |
图d
dis+= 1
pass_dis=[False] *len(mtx)
tmp=tail
for i in range(head,tail):
v=path[i]
for d in mtx[v[0] ] :
if not passed[d] :
path[tail] =
tail+= 1
pass_dis[d] =True
if d==x:
found=True
for i in range(len(mtx)): #标记已途经的顶点
if
passed[i] =True
图a 图b
dic={}
for row in lst:
if row[2] ==1:
if
dic[row[0] ] = 1
else:
dic[row[0] ] += 1
python 12.py [2,5,4,3,1]是[1,2,3,4,5]的出栈序列 python 12.py [5,2,3,1,4]不是[1,2,3,4,5]的出栈序列 |
图2
n=len(a);st=[-1] *n
top=-1;i=j= 0
while i<n:
top+=1
①
i+=1
while top>-1 and ② :
top-=1
j+=1
return top==-1
print(b,'是',a,'的出栈序列')
print(b,'不是',a,'的出栈序列')
A.①st[top]=a[i] ②st[top]==b[j] | B.①st[top]=a[i] ②st[-1]==b[j] |
C.①st[top]=b[i] ②st[top]=a[j] | D.①st[top]=b[i] ②st[-1]==a[j] |
if "A"<=s[i]<="Z":
ch=ch+chr(ord(s[i])+list[i] )
A.2-Eaa | B.2-ECE | C.E-c2e | D.E-a2b |
图1
A.执行这部分流程后,变量i的值为7 |
B.k的值为1*2*3*4*5*6*7的结果 |
C.该流程图是双重循环结构 |
D.将“i≤x/2”改成“i<x”,输出k的值发生变化 |