answer:
where m must be equal to n, n number of up to n-9, the n 9 must satisfy the condition, according to the title meaning, the first k must be and prepro sequences of k equal, so if we constructed greater than equal to the original sequence, direct output on it, otherwise, since after a certain mk is the k before repeating, we can only change the front of k, so just let the first k plus 1 on the list, then the meaning of the questions in construction again.
#include<bits/stdc++.h> using namespace std; const int N=2E5+7; char s[N],s1[N]; void solve() { int n,k; cin>>n>>k; cin>>s; for(int i=0;i<k;i++){ for(int j=i;j<n;j+=k){ s1[j]=s[i]; } } if(strcmp(s1,s)>=0){ cout<<n<<endl; printf("%s",s1); } else { for(int i=k-1;i>=0;i--){ if(s1[i]=='9') { s1[i]='0'; } else { s1[i]=s1[i]+1; break; } } for(int i=0;i<k;i++){ for(int j=i;j<n;j+=k){ s1[j]=s1[i]; } } cout<<n<<endl; printf("%s",s1); } } int main(){ solve(); return 0; }