본문 바로가기
python-algorithm

[백준] 17950

by 무적김두칠 2021. 1. 19.

1
2
3
4
5
6
7
8
9
10
11
import sys
h,x=map(int,sys.stdin.readline().split())
r=1000000007
ans=0
cnt=1
for _ in range(h):
    cnt*=x
    cnt %= r
    ans+= int(sys.stdin.readline())*cnt
    ans%=r
print(ans)
cs
반응형

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

[백준] 18238  (0) 2021.01.19
[백준] 18228  (0) 2021.01.19
[백준] 17838  (0) 2021.01.19
[백준] 17826  (0) 2021.01.19
[백준] 17608  (0) 2021.01.19

댓글