Codeforces 520E. Pluses everywhere 数学

Vasya is sitting on an extremely boring math class. To have fun, he took a piece of paper and wrote outnnumbers on a single line. After that, Vasya began to write out different ways to put pluses ("+") in the line between certain digits in the line so that the result was a correct arithmetic expression; formally, no two pluses in such a partition can stand together (between any two adjacent pluses there must be at least one digit), and no plus can stand at the beginning or the end of a line. For example, in the string100500, ways100500(add no pluses),1+00+500or10050+0are correct, and ways100++500,+1+0+0+5+0+0or100500+are incorrect.

The lesson was long, and Vasya has written all the correct ways to place exactlykpluses in a string of digits. At this point, he got caught having fun by a teacher and he was given the task to calculate the sum of all the resulting arithmetic expressions by the end of the lesson (when calculating the value of an expression the leading zeros should be ignored). As the answer can be large, Vasya is allowed to get only its remainder modulo109+7. Help him!

,都可以…孔子的,老子的. 孙子的…都可以

Codeforces 520E. Pluses everywhere 数学

相关文章:

你感兴趣的文章:

标签云: