22年计挑赛Python组区域赛个人解答
第一题:

代码部分:
生产问题
A = 100;B = 150;List=[]
a,b,c,d,e,f,g,h,i = map(int,input().split())
list=[a,b,c,d,e,f,g,h,i]
for m in range(min(g//a,h//b,i//c)+1):
n = min((g-m*a)//e,(h-m*b)//f,(i-m*c)//f)
w = A*m + B*n
List.append(w);List.append(m);List.append(n)
print(f'{List[List.index(max(List))+1]} {List[List.index(max(List))+2]} {List[List.index(max(List))]}')
第二题:
代码部分:
计算机挑战赛--乌鸦喝水
x = int(input('请输入底边的边长:\n'))
y = int(input('请输入容器内水面距离瓶子口的距离:\n'))
z = 0
while 1:
if x*x*y - 8*z < 2*x*x:
print(f'需要投放{z}个石子乌鸦才能喝到水')
break
else:
z = z + 1
第三题:

代码部分:
输出满足条件的数字
N,M = map(int,input().split());list = []
for i in range(N+1,M):
if (i-1)*(i+1) % 5 == 0:
list.append(i)
if len(list) < 3:
while len(list) < 3:
list.append(-1)
for i in list:
print(i,end=' ')
else:
for i in list:
print(i,end=' ')
第四题:

代码部分:
输出偶数
N = int(input())
List = [];list = []
it = input().split()
for i in it:
i = int(i)
list.append(i)
if N == len(list):
for i in list:
int(i)
if i % 2 == 0:
List.append(i)
if List == []:
print("输入中不含偶数项,请检查输入!")
else:
for i in List:
print(i,end = ' ')
else:
print("输入的数值错误,请重新输入!")
作者:编程小白ssss
