N-Concatenation
InterviewTime limit1.5sMemory limit1024 MB
Given N and K, find the remainder when the concatenation 123...N of the integers 1 through N is divided by K.
- Level
Easy3 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
In base 10, the number formed by writing the positive integers , , , , in order is called the -concatenation. For example, is the -concatenation, and is the -concatenation. Given and an integer , find the remainder when the -concatenation is divided by .
Input
The first line contains integers and separated by a space. (, )
Output
Print the remainder when the -concatenation is divided by on the first line.