#6242: 為什麼會WA?


LinghongWei (DragonWei)

學校 : 國立臺灣海洋大學
編號 : 23451
來源 : [27.53.225.121]
最後登入時間 :
2012-01-21 23:32:27
a022. 迴文 | From: [140.121.196.86] | 發表日期 : 2012-01-18 16:52

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
              char string[1000];
              scanf("%s", string);
              int length = strlen(string);
              char *strptr1, *strptr2;
              strptr1 = string;
              strptr2 = string+(length-1);
   
               while(strptr1 <= strptr2)
               {
                             if(*strptr1 == *strptr2)
                             {
                                         strptr1 ++;
                                         strptr2 --;
                             }             
                             else
                             {
                                         printf("no\n");
                                         break;
                             }     
               }
               if(strptr1 > strptr2)
               {
                          printf("yes\n");          
               }
               return 0;
}

系統顯示"輸出短少"...

 
ZeroJudge Forum