博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Identity Card(水题)
阅读量:5230 次
发布时间:2019-06-14

本文共 2465 字,大约阅读时间需要 8 分钟。

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
#include
#include
#include
#include
#include
#include
#include
#include
#include
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
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 "<
<<",and his/her birthday is on "<
<<","<
<<","<
<<" based on the table."<

  

 

转载于:https://www.cnblogs.com/handsomecui/p/5084243.html

你可能感兴趣的文章
[转载]树、森林和二叉树的转换
查看>>
软件测试-----Graph Coverage作业
查看>>
django ORM创建数据库方法
查看>>
创建Oracle synonym 详解
查看>>
php7 新特性整理
查看>>
RabbitMQ、Redis、Memcache、SQLAlchemy
查看>>
linux查看端口占用
查看>>
Sql常见面试题 受用了
查看>>
知识不是来炫耀的,而是来分享的-----现在的人们却…似乎开始变味了…
查看>>
CSS背景颜色、背景图片、平铺、定位、固定
查看>>
口胡:[HNOI2011]数学作业
查看>>
我的第一个python web开发框架(29)——定制ORM(五)
查看>>
中国剩余定理
查看>>
基础笔记一
查看>>
uva 10137 The trip
查看>>
Count Numbers
查看>>
编写高质量代码改善C#程序的157个建议——建议110:用类来代替enum
查看>>
网卡bond技术
查看>>
UITabbarController的UITabbarItem(例:"我的")点击时,判断是否登录
查看>>
UNIX基础知识之输入和输出
查看>>