Identity Card |
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) |
Total Submission(s): 6992 Accepted Submission(s): 2155 |
Problem Description Do you own an ID card?You must have a identity card number in your family's Household Register. From the ID card you can get specific personal information of everyone. The number has 18 bits,the first 17 bits contain special specially meanings:the first 6 bits represent the region you come from,then comes the next 8 bits which stand for your birthday.What do other 4 bits represent?You can Baidu or Google it.
|
Input Input will contain 2 parts:
|
Output Based on the table output where he is from and when is his birthday. The format you can refer to the Sample Output.
|
Sample Input
|
Sample Output
|
Author Samuel |
代码如下:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;
int main()
{
int n;
cin>>n;getchar();
while(n--)
{
char s[100];
gets(s);
cout<<"He/She is from ";
int k=(s[0]-'0')*10+(s[1]-'0');
switch(k)
{
case 33:cout<<"Zhejiang";break;
case 11:cout<<"Beijing";break;
case 71:cout<<"Taiwan";break;
case 81:cout<<"Hong Kong";break;
case 82:cout<<"Macao";break;
case 54:cout<<"Tibet";break;
case 21:cout<<"Liaoning";break;
case 31:cout<<"Shanghai";break;
}
cout<<",and his/her birthday is on ";
cout<<s[10]<<s[11]<<","<<s[12]<<s[13]<<",";
for(int i=6;i<10;i++) cout<<s[i];
cout<<" based on the table.";
cout<<endl;
}
return 0;
}