HBC15695Beautiful Trees Cutting题解

回忆凄美了谁 算法基础篇 71 0
全网最全C++题库,助您快速提升编程技能!题库丰富多样,涵盖各个领域,让您在练习中不断成长!
It’s universally acknowledged that there’re innumerable trees in the campus of HUST. One day Xiao Ming is walking on a straight roadand sees many trees line up in the right side. Heights of eachtree which is denoted by a non-negative integer from 0 to 9 can form a tree string. It's very surprising to find thatthe tree string can be represent as an initial string repeating K times. Now he wants to remove some trees to make the rest of the tree stringlooks beautiful. A string is beautiful if and only if the integer it represents is divisible by five. Now he wonders how many ways there are that he could make it. Note that when we transfer the string to a integer, we ignore the leading zeros. For example, the string “00055” will be seen as 55. And also pay attention that two ways are considered different if the removed trees are different. The result can be very large, so printing the answer is enough. And additionally, Xiao Ming can't cut down all trees.

It’s universally acknowledged that there’re innumerable trees in the campus of HUST. One day Xiao Ming is walking on a straight road and sees many trees line up in the right side. Heights of each tree which is denoted by a non-negative integer from 0 to 9 can form a tree string. It's very surprising to find that the tree string can be represent as an initial string repeating K times. Now he wants to remove some trees to make the rest of the tree string looks beautiful. A string is beautiful if and only if the integer it represents is divisible by five. Now he wonders how many ways there are that he could make it. Note that when we transfer the string to a integer, we ignore the leading zeros. For example, the string “00055” will be seen as 55. And also pay attention that two ways are considered different if the removed trees are different. The result can be very large, so printing the answer (mod 1000000007) is enough. And additionally, Xiao Ming can't cut down all trees.

HBC15695Beautiful Trees Cutting题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
成为编程大师,不再是梦想!全网最全C++题库,助您开启编程新篇章。

标签: HBC15695Beautiful Trees Cutting题解