|
|
вернуться в форумWA 14, help please! please give some test #include <stdio.h> int main() { int string[200]; int len=0; char ch; int count; ch=getchar(); while(!((ch=='\0')||(ch=='EOF')||(ch=='\n'))) { string[len]=ch-'a'; len++; ch=getchar(); } string[len]='\0'; //perviy prohod if(len==1) { printf("%c\0",string[0]-5); return 0; } if (string[0]<5) string[0]+=26; for(count=1;count<len;count++) { while(string[count]<string[count-1]) string[count]=string[count]+26; } //vtoroy prohod for(count=len-1;count>0;count--) { string[count]=string[count]-string[count-1]; } string[0]=string[0]-5; //tretiy prohod for(count=0;count<len;count++) { printf("%c",string[count]+'a'); } printf("\0"); return 0; } Re: WA 14, help please! i find my mistake. don't forget about case,when you have 1 symbol! /////////////WA 14////////// if(len==1) { printf("%c\0",string[0]-5); return 0; } ///////////////AC//////////// if(len==1) { if (string[0]<5) string[0]+=26; printf("%c\0",string[0]-5+'a'); return 0; } |
|
|