Login
Immutable PageDiscussionInfoAttachments
rei05/C言語/10023

MMA

   1 #include<stdio.h>
   2 #include<string.h>
   3 int main(){
   4 
   5 int m,h,i,j,length;
   6 char card[1000],result[1000];
   7 
   8 while(1){
   9   scanf("%s",card); if(card[0]=='-') break;
  10   length=strlen(card);
  11   scanf("%d",&m);
  12   for(i=0;i<m;i++){
  13     scanf("%d",&h);
  14     strncat(card,card,h);
  15     for(j=0;j<length;j++){
  16       result[j]=card[j+h];
  17     }
  18     result[length]='\0';
  19     strcpy(card,result);
  20   }
  21   printf("%s\n",card);
  22 }
  23 
  24 return(0);
  25 }

rei05/C言語/10023 (last edited 2012-05-14 22:35:02 by rei05)