Identity Card
2016-02-02 17:22
197 查看
Identity Card
Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)
Total Submission(s) : 97 Accepted Submission(s) : 44
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
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 bitsrepresent 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.
Here is the codes which represent the region you are in.
However,in your card,maybe only 33 appears,0000 is replaced by other numbers.
Here is Samuel's ID number 331004198910120036 can you tell where he is from?The first 2 numbers tell that he is from Zhengjiang Province,number 19891012 is his birthday date (yy/mm/dd).
Input
Input will contain 2 parts:A number n in the first line,n here means there is n test cases. For each of the test cases,there is a string of the ID card number.
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
1 330000198910120036
Sample Output
He/She is from Zhejiang,and his/her birthday is on 10,12,1989 based on the table.
Author
Samuel
Source
灰色橙子 专场#include<string> #include<algorithm> #include<iostream> #include<cstring> #include<cstdio> #include <vector> #include <queue> #include <set> #include <map> #include <math.h> #include <stdlib.h> #include <time.h> #include<iomanip> using namespace std; char* name[100]; void f() { name[33]="Zhejiang"; name[11]="Beijing"; name[71]={"Taiwan"}, name[81]={"Hong Kong"}, name[82]={"Macao"}, name[54]={"Tibet"}, name[21]={"Liaoning"}, name[31]={"Shanghai"}; } int main() { int n,num1; char id[100]; f(); cin>>n; while(n--) { cin>>id; num1=(id[0]-'0')*10+(id[1]-'0'); int year=(id[6]-'0')*1000+(id[7]-'0')*100+(id[8]-'0')*10+(id[9]-'0'); int month=(id[10]-'0')*10+(id[11]-'0'); int day=(id[12]-'0')*10+(id[13]-'0'); printf("He/She is from %s,and his/her birthday is on %02d,%02d,%04d based on the table.\n",name[num1],month,day,year); } return 0; }
相关文章推荐
- [控件]支持索引的ExpandableListView
- 第三方登陆遇到的 问题
- MyBatis的foreach语句详解
- JMS基础(1)
- 4.Java 加解密技术系列之 HMAC
- div的contenteditable和placeholder蹦出的火花
- 微软站在云端脚踏4条船,船踩得多就能航行更远?
- AJAX
- Hbase详解
- 聊聊并发(七)——Java中的阻塞队列[转]
- C#反射动态调用dll中的方法,并返回结果
- 2015年软件测试STATE报告
- protobuf 生成的C++代码详解
- Androidx学习笔记(39)--- 使用HttpClient框架做POST提交
- Unity手游之路<十三>手游代码更新策略探讨
- c#实现动态加载Dll
- python逐行读写
- HBAO
- IPv6下网络编程实例
- git 命令——git rebase 用法