본문 바로가기
python-algorithm

[백준] 1703

by 무적김두칠 2020. 12. 17.

1
2
3
4
5
6
7
8
9
10
11
import sys
while  1:
    tmp=list(map(int, sys.stdin.readline().split()))
    if tmp[0]==0: exit()
    else:
        ans=1
        if tmp[0]==1print(tmp[1]-tmp[2])
        else:
            for i in range(1,tmp[0]+1):
                ans=tmp[i*2-1]*ans-tmp[i*2]
            print(ans)
cs
반응형

'python-algorithm' 카테고리의 다른 글

[백준] 1864  (0) 2020.12.17
[백준] 1837  (0) 2020.12.17
[백준] 1598  (0) 2020.12.17
[백준] 1267  (0) 2020.12.17
[백준] 1247  (0) 2020.12.17

댓글