Skip to content

Instantly share code, notes, and snippets.

@pinglunliao
Last active November 5, 2019 08:33
Show Gist options
  • Save pinglunliao/2bfb244a4a4620ae7b0a to your computer and use it in GitHub Desktop.
Save pinglunliao/2bfb244a4a4620ae7b0a to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main()
{
short encode[] = {
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
};
const short SIZE = 8;
char a;
int n;
while( cin >> a >> n)
{
int temp = encode[a - 'A'];
int check = (temp % 10) * 9 + temp / 10;
check += (n % 10);
n = n / 10;
for(int i = 1; i <= SIZE; i++)
{
check += (n % 10) * i;
n = n / 10;
}
if( check % 10 == 0 )
cout << "real";
else
cout << "fake";
cout << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment