Identity Card

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2696    Accepted Submission(s): 1048

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. 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
 

水题:给你身份证号让你找信息;注意string不能用scanf输入。。。

代码:

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<string>
using namespace std;
const int INF=0x3f3f3f3f;
const double PI=acos(-1.0);
#define mem(x,y) memset(x,y,sizeof(x))
#define SI(x) scanf("%d",&x)
#define SL(x) scanf("%lld",&x)
#define PI(x) printf("%d",x)
#define PL(x) printf("%lld",x)
#define P_ printf(" ")
#define T_T while(T--)
typedef long long LL;
map<string,string>mp;
int main(){
int T,y,m,d;
string s;
SI(T);
mp["33"]="Zhejiang";
mp["11"]="Beijing";
mp["71"]="Taiwan";
mp["81"]="Hong Kong";
mp["82"]="Macao";
mp["54"]="Tibet";
mp["21"]="Liaoning";
mp["31"]="Shanghai";
T_T{
//scanf("%s",s.c_str());
cin>>s;
printf("He/She is from %s,and his/her birthday is on %s,%s,%s based on the table.\n",mp[s.substr(0,2)].c_str(),s.substr(10,2).c_str(),s.substr(12,2).c_str(),s.substr(6,4).c_str());
//cout<<"He/She is from "<<mp[s.substr(0,2)]<<",and his/her birthday is on "<<s.substr(10,2)<<","<<s.substr(12,2)<<","<<s.substr(6,4)<<" based on the table."<<endl;
}
return 0;
}

  

Identity Card(水题)的更多相关文章

  1. hdu 2629 Identity Card (字符串解析模拟题)

    这题是一个字符串模拟水题,给12级学弟学妹们找找自信的,嘿嘿; 题目意思就是要你讲身份证的上的省份和生日解析出来输出就可以了: http://acm.hdu.edu.cn/showproblem.ph ...

  2. poj 1003:Hangover(水题,数学模拟)

    Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 99450   Accepted: 48213 Descri ...

  3. HDU 4772 Zhuge Liang's Password (2013杭州1003题,水题)

    Zhuge Liang's Password Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/O ...

  4. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  5. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  6. ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)

    1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 154  Solved: 112[ ...

  7. [poj2247] Humble Numbers (DP水题)

    DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...

  8. gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,

    1195: 相信我这是水题 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 821  Solved: 219 Description GDUT中有个风云人 ...

  9. BZOJ 1303 CQOI2009 中位数图 水题

    1303: [CQOI2009]中位数图 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 2340  Solved: 1464[Submit][Statu ...

随机推荐

  1. 利用border和伪类画出三角形 ps:好久没写博客了。。。

    有一个半月没有写博客了,这段时间,小哥我经历了自入行前端最为黑暗的时期,迷茫,空虚,不想写代码,不想做研究了.连打游戏都没有兴趣,如同行尸走肉一般.还好,毕业论文的初稿完成后,整个时间段最恶心最难熬的 ...

  2. Ajax中XML和JSON格式的优劣比较

    刚做完一个小的使用Ajax的项目.整个小项目使用JavaScript做客户端,使用PHP做服务器端.利用xmlHttpRequest组件作为交互工具,利用XML作为数据传输的格式.做完后基本做一个简单 ...

  3. mysql函数操作(3)

    <?php $dbh = new PDO('mysql:dbname=testdb;host=localhost', 'mysql_user', 'mysql_pwd'); $dbh->s ...

  4. codeforces 27E . Number With The Given Amount Of Divisors 搜索+数论

    题目链接 首先要知道一个性质, 一个数x的因子个数等于 a1^p1 * a2^p2*....an^pn, ai是x质因子, p是质因子的个数. 然后就可以搜了 #include <iostrea ...

  5. Arduino当avr开发板

    原理并不复杂,因为arduino本来就是avr+一堆的库,找个能编译出hex的工具下载到板子就行. 但实际做起来还是碰到很多问题. 先是尝试eclipse+avr plugin 编译时出现make: ...

  6. perl 分析binlog 定位错误sql 思路

    1. 获取需要的binlog 日志: [root@zjzc01 binlog]# mysqlbinlog --start-datetime='2016-08-01 00:00:00' --stop-d ...

  7. iOS中的retainCount

    我们都知道iOS中采用引用计数的技术来管理内存,当一个对象没有任何一个地方引用的时候会自动释放,此时的retainCount为0,而且提供了一个-(NSInteger)retainCount的方法来获 ...

  8. Oracle_用户管理

    创建用户: CREATE USER user   --创建用户user IDENTIFIED {BY password | EXTERNALLY}  --设备用户密码,EXTERNALLY说用该用户由 ...

  9. nodejs开发微信1——微信access-token和tickets的数据模型

    /* jshint -W079 */ /* jshint -W020 */ "use strict"; //var _ = require("lodash"); ...

  10. 走进小作坊(十一)----移动web实现指南

    四.五年前智能手机行业刚刚兴起,差别于之前功能机阉割版的web开发方式,一些学者就開始探索移动web的UI方向了.从PC迁移到移动端的web设计现成可用的原则有,很多其它的则是依据移动端独有特点进行探 ...