#41486: python


yan1008 (yan)

學校 : 不指定學校
編號 : 276008
來源 : [123.194.206.207]
最後登入時間 :
2024-10-20 00:53:13
k466. 成績分析 (Analysis) -- TOI練習賽202304新手組第1題 | From: [123.194.206.207] | 發表日期 : 2024-07-31 02:48

n, m = map(int, input().split())
total_score = []
progress = []
regress = []
good = 0   # 紀錄進步最大值
bad = 0    # 紀錄退步最大值
best_progress_student = -1       # 學生座號
worst_regress_student = -1

for i in range(n):
    total_score.append([int(x) for x in input().split()])

for i in range(n):
    current_progress = 0    # 累加當前學生進步幅度
    current_regress = 0     # 累加當前學生退步幅度
    for j in range(m-1):
        diff = total_score[i][j+1] - total_score[i][j]   #計算這次與上次考試分數的差值
        if diff > 0:
            current_progress += diff
        else:
            current_regress += -diff
    if current_progress > good:
        good = current_progress
        best_progress_student = i + 1
    if current_regress > bad:
        bad = current_regress
        worst_regress_student = i + 1
print(best_progress_student)
print(worst_regress_student)
 
ZeroJudge Forum