【題解】ZeroJudge e970: 1. 粉專抽獎 (Lucky Draw)

【題目敘述】https://zerojudge.tw/ShowProblem?problemid=e970

Python code (credit: Amy Chou)

N = int(input())
R = list(map(int, input().split()))
B = R[-1]
total = 0
for i in range(1, N+1, B):
    total += R[i-1]

M = total % N
if M == 0:
    M = N
print(M, R[M-1])
分享本文 Share with friends