Horner's method1 [백준] 19575 1 2 3 4 5 6 7 8 9 10 11 12 13 14 import sys cnt=0 n,x=map(int, sys.stdin.readline().split()) index=[0]*(n+1) for i in range(n+1): a, ai=map(int,sys.stdin.readline().split()) index[ai]=a index=index[::-1] start=index[0]*x+index[1] for i in range(2,n+1): start= start*x+index[i] start%=(10**9+7) print(start) Colored by Color Scripter cs 문제에서 언급한대로 다항식을 개선해서 하지 않고 머리속에 떠오른 그대로 구현하면 시간초과가 뜹니더 예를들면~ 에.. 2021. 2. 8. 이전 1 다음