#2196: 為啥這樣不能動?


poiu790621 (歪歪)

學校 : 中華大學
編號 : 5243
來源 : [140.126.21.236]
最後登入時間 :
2011-05-27 11:21:59
a020. 身分證檢驗 | From: [220.136.222.1] | 發表日期 : 2009-07-26 11:36

#include <iostream>
#include <cmath>
using namespace std;

int main(){
char a[11];
int i=0, j;
while(cin >> a){
         
if(a[0]=='A')         
i = 1 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='B'){        
i = 1 + 9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='C'){         
i = 1 + 2*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='D'){        
i = 1 + 3*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='E'){        
i = 1 + 4*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='F'){        
i = 1 + 5*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='G'){        
i = 1 + 6*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='H'){        
i = 1 + 7*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='I'){        
i = 3 + 4*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='J'){        
i = 1 + 8*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='K'){        
i = 1 + 9*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='L'){        
i = 2 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='M'){        
i = 2 + 9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='N'){        
i = 2 + 2*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='O'){        
i = 3 + 5*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='P'){        
i = 2 + 3*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='Q'){        
i = 2 + 4*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='R'){        
i = 2 + 5*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='S'){        
i = 2 + 6*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='T'){        
i = 2 + 7*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='U'){        
i = 2 + 8*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='V'){        
i = 2 + 9*9 +a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='W'){        
i = 3 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='X'){        
i = 3 + 9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='Y'){        
i = 3 + 2*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

else if(a[0]=='Z'){        
i = 3 + 3*9 + a[1]*8 + a[2]*7 + a[3]*6 + a[4]*5 + a[5]*4 + a[4]*3 + a[3]*2 + a[4] + a[5];
if(i%10==0) cout << "real\n";
else cout << "fake\n";
}

system("pause");
return 0;  
}

 

可以請問一下為什麼這樣不能執行嗎?

 
ZeroJudge Forum