a054.
電話客服中心
--
板橋高中教學題
| From: [180.177.116.3] |
發表日期
:
2013-02-14 20:09
我確定我宣告的陣列正常(以前類似的程式也AC過),私下測試也正常,為什麼記憶體區段會錯誤...
以下為程式碼:
#include <stdio.h>
#include <stdlib.h>
static char *NumberHead[10]={"BNZ","AMW","KLY","JVX","HU","GT","FS","ER","DOQ","CIP"};
int main(){
int p,j,c=0;
while(scanf("%d",&p)!=EOF){
c=p%10;
for(j=8;j>=0;j--){
c+=(p%10)*(8-j);
p=p/10;
}
c=10-(c%10);
printf("%s\n",NumberHead[c]);
}
return 0;
}