#include
using namespace std;
#include
bool CheckIsReal(int thesum,int thei);
int main()
{
string ID;
while (cin>>ID)
{
int sum=0;
for(int index=0,mul=8;mul>=1;index++,mul--)
{
sum += ( (ID[index]-(int)'0') * mul );
}
sum += (ID[8]-'0'); //最後一位數 千萬要注意'8'跟數字8是不同的!!
for(int i=0;i<=25;i++)
{
if (CheckIsReal(sum,i))
cout<<(char)(i+'A');
}
cout<}
return 0;
}
bool CheckIsReal(int thesum,int thei)
{
int v[]=
{ 10, 11, 12, 13, 14, 15, 16, 17, 34, 18, 19, 20, 21,
22, 35, 23, 24, 25, 26, 27, 28, 29, 32, 30, 31, 33};
int temp=0;
thesum += v[thei] / 10 ;
thesum += (v[thei]%10)*9;
if (thesum%10==0)
return 1;
else
return 0;
}
Sunday, August 7, 2011
a054. 電話客服中心
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment