1218: String left shift time limit: 1 Sec Memory limit: 2 MB
Submitted by: Resolution: 10
Label submission Statistics Discussion edition
Title Description
Give a string with a length equal to N, and ask it to move the string after the M bit to the left.
Input
Two rows per set of data, first row N M, 0<n<=1000,0<=m<=1500
The second line gives the string, and the string contains only uppercase and lowercase letters.
Output
Outputs the result after the left shift.
Sample input6 3Netcan6 2NetcanTen 4HelloWorldSample outputCanNetTcanneOworldhellAt first, I didn't notice the range of M is greater than n
#include <iostream>#include<cstdio>#include<cstring>using namespacestd;intMain () {intLen,n,i; Chara[1001]; while(~SCANF ("%d%d",&len,&N)) {n=n%Len; scanf ("%s", a); for(i=n;i<len;i++) printf ("%c", A[i]); for(i=0; i<n;i++) printf ("%c", A[i]); cout<<Endl; }}
Move the string left