1219C.md (1472B)
1 Source: https://codeforces.com/problemset/problem/1219/C 2 3 C. Periodic integer number 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 Alice became interested in periods of integer numbers. We say positive $X$ integer number is periodic with length $L$ if there exists positive integer number $P$ with $L$ digits such that $X$ can be written as $PPPP…P$. For example: 22 23 $X = 123123123$ is periodic number with length $L = 3$ and $L = 9$ 24 25 $X = 42424242$ is periodic number with length $L = 2,L = 4$ and $L = 8$ 26 27 $X = 12345$ is periodic number with length $L = 5$ 28 29 For given positive period length $L$ and positive integer number $A$, Alice wants to find smallest integer number $X$ strictly greater than $A$ that is periodic with length L. 30 31 Input 32 33 First line contains one positive integer number $L \ (1 \leq L \leq 10^5)$ representing length of the period. Second line contains one positive integer number $A \ (1 \leq A \leq 10^{100 000})$. 34 35 Output 36 37 One positive integer number representing smallest positive number that is periodic with length $L$ and is greater than $A$. 38 39 Examples 40 41 Input 42 43 ``` 44 3 45 123456 46 ``` 47 48 Output 49 50 ``` 51 124124 52 ``` 53 54 Input 55 56 ``` 57 3 58 12345 59 ``` 60 61 Output 62 63 ``` 64 100100 65 ``` 66 67 Note 68 69 In first example 124124 is the smallest number greater than 123456 that can be written with period L = 3 (P = 124). 70 71 In the second example 100100 is the smallest number greater than 12345 with period L = 3 (P=100)