~~~~~↵
[D. Min Cost String](https://mirror.codeforces.com/contest/1511/problem/D)↵
I have an intutive approach but I want to know why he work??I want proof??↵
suppose we will use the first 5 character..↵
first: we will put the the characters at even position like that:↵
`a_b_c_d_e_a_b_c_d_e_a_b_c_d_e`↵
~~~~~↵
↵
~~~~~↵
the the first k chars at even positions we will shift them by 1↵
and put the shifted chars at odd positions like that ↵
`a_b_c_d_e`↵
`_b_c_d_e_a`↵
`abbccddeea`↵
~~~~~↵
↵
~~~~~↵
the second k chars at even positions we will shift them by 2↵
and put the shifted chars at odd positions like that ↵
`a_b_c_d_e`↵
`_c_d_e_a_b`↵
`acbdcedaeb`↵
~~~~~↵
↵
~~~~~↵
you can say that the char at odd position j is equal to the char at position (j-1) plus number of shifts like s[j]=(s[j-1]+sh)%k;↵
sorry for my bad english...can someone prove it??↵
~~~~~↵
↵
↵
here's [my submision](https://mirror.codeforces.com/contest/1511/submission/158647516) ↵
↵
[D. Min Cost String](https://mirror.codeforces.com/contest/1511/problem/D)↵
I have an intutive approach but I want to know why he work??I want proof??↵
suppose we will use the first 5 character..↵
first: we will put the the characters at even position like that:↵
`a_b_c_d_e_a_b_c_d_e_a_b_c_d_e`↵
~~~~~↵
↵
~~~~~↵
the the first k chars at even positions we will shift them by 1↵
and put the shifted chars at odd positions like that ↵
`a_b_c_d_e`↵
`_b_c_d_e_a`↵
`abbccddeea`↵
~~~~~↵
↵
~~~~~↵
the second k chars at even positions we will shift them by 2↵
and put the shifted chars at odd positions like that ↵
`a_b_c_d_e`↵
`_c_d_e_a_b`↵
`acbdcedaeb`↵
~~~~~↵
↵
~~~~~↵
you can say that the char at odd position j is equal to the char at position (j-1) plus number of shifts like s[j]=(s[j-1]+sh)%k;↵
sorry for my bad english...can someone prove it??↵
~~~~~↵
↵
↵
here's [my submision](https://mirror.codeforces.com/contest/1511/submission/158647516) ↵
↵