0w1

CFR 120 B. Quiz League ( Python read / write file )

Problem - B - Codeforces

題意:
很水,不太重要,這裡記錄 python 的讀 / 寫檔。
前三行有,就等價 C++ 開了 freopen()

import sys
sys.stdin = open( 'input.txt', 'r' )
sys.stdout = open( 'output.txt', 'w' )
N, K = map( int, input().split() )
K -= 1
A = list( map( int, input().split() ) )
while A[ K ] == 0:
  K += 1
  if K == N:
    K = 0
print( K + 1 )