#44387: python 淺顯易懂(比較長)


suyueh (suyueh)

學校 : 不指定學校
編號 : 272111
來源 : [101.9.53.132]
最後登入時間 :
2025-03-31 22:55:58
b964. 1. 成績指標 -- 2016年3月apcs | From: [101.10.92.238] | 發表日期 : 2024-12-01 22:21

p = int(input())
list1 = input()
list2 = list1 # 保留原始輸入
list1 = list(map(int, list1.split())) # 轉換為整數列表
h, l, x, y = 101, 0, 0, 0

for score in list1:
if score > 59 and score < h:
h = score
elif score < 60 and score > l:
l = score

if score > 59:
x += 1
elif score < 60:
y += 1

# 將 list2 轉換為數字列表並排序
list2 = list(map(int, list2.split()))
list2.sort() # 由小到大排序

print(*list2) # 輸出排序後的 list2

if x == len(list1):
print("best case")
print(h)
elif y == len(list1):
print(l)
print("worst case")
else:
print(l)
print(h)
 
#45499: Re: python 淺顯易懂(比較長)


henryko (henry)

學校 : 臺北市立內湖國民小學
編號 : 273167
來源 : [123.252.21.196]
最後登入時間 :
2025-04-07 20:22:14
b964. 1. 成績指標 -- 2016年3月apcs | From: [123.252.21.196] | 發表日期 : 2025-03-09 19:08

哥們你這樣會NA阿

 
ZeroJudge Forum