#include <iostream>
using namespace std;
int main()
{char id[12];
int num0,num1,i,num2[12],sum;
while (cin>>id)
{
switch (id[0])
{
case 'A':
num0=1;
num1=0;
break;
case 'B':
num0=1;
num1=1;
break;
case 'C':
num0=1;
num1=2;
break;
case 'D':
num0=1;
num1=3;
break;
case 'E':
num0=1;
num1=4;
break;
case 'F':
num0=1;
num1=5;
break;
case 'G':
num0=1;
num1=6;
break;
case 'H':
num0=1;
num1=7;
break;
case 'I':
num0=3;
num1=4;
break;
case 'i':
num0=1;
num1=8;
break;
case 'K':
num0=1;
num1=9;
break;
case 'L':
num0=2;
num1=0;
break;
case 'M':
num0=2;
num1=1;
break;
case 'N':
num0=2;
num1=2;
break;
case 'O':
num0=3;
num1=5;
break;
case 'P':
num0=2;
num1=3;
break;
case 'Q':
num0=2;
num1=4;
break;
case 'R':
num0=2;
num1=5;
break;
case 'S':
num0=2;
num1=6;
break;
case 'T':
num0=2;
num1=7;
break;
case 'U':
num0=2;
num1=8;
break;
case 'V':
num0=2;
num1=9;
break;
case 'W':
num0=3;
num1=0;
break;
case 'X':
num0=3;
num1=1;
break;
case 'Y':
num0=3;
num1=2;
break;
case 'Z':
num0=3;
num1=3;
break;
}
for (i=1;i<10;i++)
{
switch (id[i])
{
case '0':
num2[i]=0;
break;
case '1':
num2[i]=1;
break;
case '2':
num2[i]=2;
break;
case '3':
num2[i]=3;
break;
case '4':
num2[i]=4;
break;
case '5':
num2[i]=5;
break;
case '6':
num2[i]=6;
break;
case '7':
num2[i]=7;
break;
case '8':
num2[i]=8;
break;
case '9':
num2[i]=9;
break;
}
}
sum=num0+(num1*9)+(num2[1]*8)+(num2[2]*7)+(num2[3]*6)+(num2[4]*5)+(num2[5]*4)+(num2[6]*3)+(num2[7]*2)+(num2[8]*1)+(num2[9]);
if ((sum%10)==0)
{
cout<<"real"<<endl;
}
if ((sum%10!=0))
{
cout<<"fake"<<endl;
}
}
system("pause");
return 0;
}
一直顯示 line9
你的答案:fake
正確答案:real
#include
using namespace std;
int main()
{char id[12];
int num0,num1,i,num2[12],sum;
while (cin>>id)
{
switch (id[0])
{
case 'A':
num0=1;
num1=0;
break;
case 'B':
num0=1;
num1=1;
break;
case 'C':
num0=1;
num1=2;
break;
case 'D':
num0=1;
num1=3;
break;
case 'E':
num0=1;
num1=4;
break;
case 'F':
num0=1;
num1=5;
break;
case 'G':
num0=1;
num1=6;
break;
case 'H':
num0=1;
num1=7;
break;
case 'I':
num0=3;
num1=4;
break;
case 'i':
num0=1;
num1=8;
break;
case 'K':
num0=1;
num1=9;
break;
case 'L':
num0=2;
num1=0;
break;
case 'M':
num0=2;
num1=1;
break;
case 'N':
num0=2;
num1=2;
break;
case 'O':
num0=3;
num1=5;
break;
case 'P':
num0=2;
num1=3;
break;
case 'Q':
num0=2;
num1=4;
break;
case 'R':
num0=2;
num1=5;
break;
case 'S':
num0=2;
num1=6;
break;
case 'T':
num0=2;
num1=7;
break;
case 'U':
num0=2;
num1=8;
break;
case 'V':
num0=2;
num1=9;
break;
case 'W':
num0=3;
num1=0;
break;
case 'X':
num0=3;
num1=1;
break;
case 'Y':
num0=3;
num1=2;
break;
case 'Z':
num0=3;
num1=3;
break;
}
for (i=1;i<10;i++)
{
switch (id[i])
{
case '0':
num2[i]=0;
break;
case '1':
num2[i]=1;
break;
case '2':
num2[i]=2;
break;
case '3':
num2[i]=3;
break;
case '4':
num2[i]=4;
break;
case '5':
num2[i]=5;
break;
case '6':
num2[i]=6;
break;
case '7':
num2[i]=7;
break;
case '8':
num2[i]=8;
break;
case '9':
num2[i]=9;
break;
}
}
sum=num0+(num1*9)+(num2[1]*8)+(num2[2]*7)+(num2[3]*6)+(num2[4]*5)+(num2[5]*4)+(num2[6]*3)+(num2[7]*2)+(num2[8]*1)+(num2[9]);
if ((sum%10)==0)
{
cout<<"real"< }
if ((sum%10!=0))
{
cout<<"fake"< }
}
system("pause");
return 0;
}
一直顯示 line9
你的答案:fake
正確答案:real