关闭

hdu2629 Identity Card (2016xynu暑期集训检测 -----F题)

标签: hdu2629hdu 2629
1339人阅读 评论(0) 收藏 举报
分类:

Identity Card

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


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
 

Source
 

Recommend
zty
 

Statistic | Submit | Discuss | Note

除了这句话  啥都不说了  就是让你解释字符串呢

#include <stdio.h>
#include <iostream>
#include <map>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	map<int,string>mp;
	mp[33]="Zhejiang";
	mp[11]="Beijing";
	mp[71]="Taiwan";	
	mp[81]="Hong Kong";	
	mp[54]="Tibet";	
	mp[82]="Macao";
	mp[21]="Liaoning";
	mp[31]="Shanghai";
	while(n--)
	{
		char id[20];
		scanf("%s",id);
		int x=(id[0]-'0')*10+(id[1]-'0');
		cout<<"He/She is from "+mp[x]+",and his/her birthday is on "+id[10]+id[11]+","+id[12]+id[13]+","+id[6]+id[7]+id[8]+id[9]+" based on the table."<<endl; 
	}
	return 0;
}



1
0
查看评论

HDU2629:Identity Card

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 ...
  • libin56842
  • libin56842
  • 2013-01-10 15:19
  • 1603

HDU2629 Identity Card

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 spec...
  • u011151784
  • u011151784
  • 2017-05-03 16:23
  • 196

HDU2629 Identity Card【MAP+水题】

Identity Card Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4120 &...
  • tigerisland45
  • tigerisland45
  • 2017-07-02 00:06
  • 358

poj2935 Basic Wall Maze (2016xynu暑期集训检测 -----D题)

Description In this problem you have to solve a very simple maze consisting of: a 6 by 6 grid of unit squares 3 walls of length between 1 and...
  • su20145104009
  • su20145104009
  • 2016-08-31 13:36
  • 1300

hdu2191 多重背包(2016xynu暑期集训检测 -----B题)

Problem Description 急!灾区的食物依然短缺! 为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买。 请问:你用有限的资金最多能采购多少公斤粮食呢? 后...
  • su20145104009
  • su20145104009
  • 2016-08-31 13:19
  • 1196

hdu1213 How Many Tables (2016xynu暑期集训检测 -----A题)

How Many Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 25062&#...
  • su20145104009
  • su20145104009
  • 2016-08-31 13:12
  • 1237

hdu1873 看病要排序 (2016xynu暑期集训检测 -----E题)

Description 看病要排队这个是地球人都知道的常识。 不过经过细心的0068的观察,他发现了医院里排队还是有讲究的。0068所去的医院有三个医生(汗,这么少)同时看病。而看病的人病情有轻重,所以不能根据简单的先来先服务的原则。所以医院对每种病情规定了10种不同的优先级。级别为10的优先权...
  • su20145104009
  • su20145104009
  • 2016-08-31 13:40
  • 1283

Hdu 2629 Identity Card【字符串】

Identity Card Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2721 Accepted Submission(s):...
  • liuke19950717
  • liuke19950717
  • 2016-01-14 21:56
  • 375

WindowsNT设备驱动程序开发基础

一、背景介绍 1.1WindowsNT操作系统的组成 1.1.1用户模式(UserMode)与内核模式(KernelMode)   从Intel80386开始,出于安全性和稳定性的考虑,该系列的CPU可以运行于ring0~ring3从高到低四个不同的权限级,对数据也提供相应的四个保护级别。...
  • xd1103121507
  • xd1103121507
  • 2011-12-09 21:59
  • 986

杭电ACM 2629: Identity Card

原创作品 转载请注明出处http://blog.csdn.net/always2015/article/details/45391791整个题目难点就是获取字符串的各位的值,很容易想到利用下标就可以做出来,但是我在这里用到了一个截取字符串的函数substr(),觉得比较方便,该函数的用法见下面一个示...
  • Always2015
  • Always2015
  • 2015-04-30 10:40
  • 782
    个人资料
    • 访问:1429346次
    • 积分:21087
    • 等级:
    • 排名:第441名
    • 原创:602篇
    • 转载:18篇
    • 译文:0篇
    • 评论:376条
    你只管努力 其它交给时光

    点图片联系我


    唐唐女神

    点图片联系我

    访问统计
    Flag Counter
    博客专栏
    最新评论