HBC24250完美主义者,线性dp,动态规划[USACO 2018 Jan G]Stamp Painting题解

初见你 算法基础篇 37 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
Bessie has found herself in possession of anN-unit long strip of canvas (1≤N≤1061leq Nleq 10^61≤N≤106), and she intends to paint it. However, she has been unable to acquire paint brushes. In their pla

Bessie has found herself in possession of an N-unit long strip of canvas (1≤N≤1061leq Nleq 10^61≤N≤106), and she intends to paint it. However, she has been unable to acquire paint brushes. In their place she has M rubber stamps of different colors (1≤M≤1061leq M leq 10^61≤M≤106), each stamp KK units wide (1≤K≤1061leq K leq 10^61≤K≤106). Astounded by the possibilities that lie before her, she wishes to know exactly how many different paintings she could conceivably create, by stamping her stamps in some order on the canvas. To use a stamp, it must first be aligned with exactly K neighboring units on the canvas. The stamp cannot extend beyond the ends of the canvas, nor can it cover fractions of units. Once placed, the stamp paints the K covered units with its color. Any given stamp may be used multiple times, once, or even never at all. But by the time Bessie is finished, every unit of canvas must have been painted at least once. Help Bessie find the number of different paintings that she could paint, modulo 109+710^9+7109+7. Two paintings that look identical but were painted by different sequences of stamping operations are counted as the same. For at least 75% of the input cases, N,K≤103N,K leq 10^3N,K≤103.

HBC24250完美主义者,线性dp,动态规划[USACO 2018 Jan G]Stamp Painting题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。

标签: HBC24250完美主义者 线性dp 动态规划[USACO 2018 Jan G]Stamp Painting题解