CF1268A.Long Beautiful Integer
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given an integer x of n digits a1,a2,…,an , which make up its decimal notation in order from left to right.
Also, you are given a positive integer k<n .
Let's call integer b1,b2,…,bm beautiful if bi=bi+k for each i , such that 1≤i≤m−k .
You need to find the smallest beautiful integer y , such that y≥x .
输入格式
The first line of input contains two integers n,k ( 2≤n≤200000,1≤k<n ): the number of digits in x and k .
The next line of input contains n digits a1,a2,…,an ( a1=0 , 0≤ai≤9 ): digits of x .
输出格式
In the first line print one integer m : the number of digits in y .
In the next line print m digits b1,b2,…,bm ( b1=0 , 0≤bi≤9 ): digits of y .
输入输出样例
输入#1
3 2 353
输出#1
3 353
输入#2
4 2 1234
输出#2
4 1313