Softeer: H-클린알파

2021. 10. 13. 18:18Algorithm

    목차
반응형

 

import sys


P, N = map(int, sys.stdin.readline().split())
virus = list(map(int, sys.stdin.readline().split()))
mul = P

if len(virus) >= 2:
    for i in range(len(virus) - 2, -1, -1):
        virus[i] = (virus[i]*mul)%1000000007
        mul = (mul*P)%1000000007

print(sum(virus)%1000000007)

 

 

반응형

'Algorithm' 카테고리의 다른 글

Softeer: 로봇이 지나간 경로  (0) 2021.10.15
Softeer: 징검다리2  (0) 2021.10.14
Softeer: GBC  (0) 2021.10.13
2027. Minimum Moves to Convert String  (0) 2021.10.10
GINI야 도와줘  (0) 2021.10.09