a020.
身分證檢驗
| From: [140.118.175.37] |
發表日期
:
2012-02-10 20:14
#include<iostream>
#include <cstdlib>
#include <cmath>
#include<string>
int main()
{
int a = 0 , b , c , d ,e;
bool qqq ;
std::string s;
while( std::cin>> s )
{
a = 0;
for ( int i = 8 ; i != 0 ; i-- )
{
a = a + ( s[ i ] - 48 ) * ( 9 - i ) ;
e = ((char)s[ i ]);
//std::cout<<((char)e)<<" "<<s[i]<<std::endl;
}
if ( s [ 0 ] >= 74 && s [ 0 ] <= 90 )
{
b = s [ 0 ] - 57 ;
}
if ( s [ 0 ] == 73 )
{
b = 34 ;
}
if ( s [ 0 ] >= 65 && s [ 0 ] <= 72 )
{
b = s [ 0 ] - 55 ;
}
c = b / 10 ;
d = b % 10 ;
a = a + ( s[ 9 ] - 48 ) + c + d * 9 ;
if ( a % 10 == 0 )
{
std::cout<<"real"<<std::endl;
}
else
{
std::cout<<"fake"<<std::endl;
}
}
return 0 ;
}