Identity Card
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 11638 Accepted Submission(s): 4278

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.

虽然这题很水,不过为了节省时间,还是推荐大家用C++去做了(看了一些博客的C做法,觉得有些散乱.)通过C++的字符串函数,这题是很简洁明了的。
AC代码如下:

#include<iostream>
using namespace std;
int main()
{int n;while(cin>>n){while(n--){string s,a,b,c,d; //以字符串形式读取cin>>s;a=s.substr(0,2);  //取字符串第1到3位,即出生地b=s.substr(10,2); //取字符串第10到12位,出生日c=s.substr(12,2); //取字符串第12到2位,出生月d=s.substr(6,4);  //取字符串第6到10位,出生年cout<<"He/She is from ";if(a=="33") cout<<"Zhejiang,";   //字符串比较else if(a=="11") cout<<"Beijing,";else if(a=="71") cout<<"Taiwan,";else if(a=="81") cout<<"Hong Kong,";else if(a=="82") cout<<"Macao,";else if(a=="54") cout<<"Tibet,";else if(a=="21") cout<<"Liaoning,";else if(a=="31") cout<<"Shanghai,";cout<<"and his/her birthday is on "<<b<<","<<c<<","<<d<<" based on the table."<<"\n";}}return 0;
}

杭电OJ 2629 Identity Card(C++)相关推荐

  1. 杭电OJ分类题目(4)-Graph

    原题出处:HDOJ Problem Index by Type,http://acm.hdu.edu.cn/typeclass.php 杭电OJ分类题目(4) HDU Graph Theory - U ...

  2. 杭电OJ(HDOJ)入门题目列表

    杭电OJ链接: http://acm.hdu.edu.cn/ 注册与使用指南: https://blog.csdn.net/qq_38769551/article/details/101510000 ...

  3. 【ACM】杭电OJ 2037

    题目链接:杭电OJ 2037 先把b[i]进行排序,然后,b[i]与a[i+1]进行比较. #include <iostream> #include <cstdio> #inc ...

  4. 【ACM】杭电OJ 2020(排序)

    题目链接:杭电OJ 2020 排序可以有冒泡排序,选择排序,或者直接调用函数. 下面是选择排序: #include <stdio.h> #include <math.h> in ...

  5. 【ACM】杭电OJ 2018

    题目链接:杭电OJ 2018 从n>4开始,每一年的牛的数量=前一年的牛的数量+三年前的牛的数量 问:为什么是三年前? 答:假设三年前有一头小牛出生,出生的那一年即为第一年,到了第四年,即三年后 ...

  6. 【ACM】杭电OJ 1005

     题目链接:杭电OJ 1005 超时代码如下(而且开辟的数组空间大小不够): #include <stdio.h> int m[100000]; int f(int n,int a,int ...

  7. 【ACM】杭电OJ 1004

     题目链接:杭电OJ 1004 运行环境:Dev-C++ 5.11 思路: 先把先把num数组全部赋值为1:第一个颜色单独输入,从第二个开始,需要与前面的进行比较,如果前面有相同的颜色,则在目前的nu ...

  8. 【ACM】杭电OJ 2012。

    题目链接:杭电OJ 2012 思路很简单,但是有一种高效算法显示编译错误,不知道为什么 运行环境:VS2017 AC代码: #include <stdio.h> #include < ...

  9. 【ACM】杭电OJ 1003。

    运行环境VS2017  题目链接:杭电OJ 1003 主要思想是: 用d[i]来存放前i项中最大的和,得到end,然后再倒推,得起始的位置begin 然而在程序42行的疑问,大家可以讨论一下吗???? ...

最新文章

  1. core和node开发小程序_成都小程序开发:微信小程序开发要多少钱?
  2. 客户旅程_我们进入微服务世界的旅程-以及从中学到的东西。
  3. navigator属性
  4. XenApp_XenDesktop_7.6实战篇之十三:安装Virtual Delivery Agent For Windows Desktop OS
  5. 人脸关键点:TCDCN-Facial Landmark Detection by Deep Multi-task Learning
  6. mysql 分页_MySQL 如何优化大分页查询?
  7. Java 接口中使用数组缺点的理由
  8. 三菱plc pwm指令_西门子PLC常见的20个问题,你碰到过几个?
  9. oracle的简单命令
  10. Java EE互联网轻量级框架整合开发
  11. curl: (6) Could not resolve host: www.huobi.me; Unknown error
  12. 仿百度文库解决方案——利用FlexPaper显示Flash(SWF)
  13. 撤消 git rebase
  14. Github连接不上怎么办?
  15. hdu6441 Find Integer
  16. 怎么定位门面位置_如何选择店面位置
  17. Janky frames 是如何计算出来的
  18. C语言冒泡法输出成绩与学号,C语言:根据成绩进行冒泡排序,学号也得跟着动,输出的结果...
  19. 海信A5 pro 测评
  20. 华为eNSP路由器报错误代码:40,41的问题解决办法。路由器启动无限###。eNSP安装。

热门文章

  1. Photoshop插件-锐化-高反差保留仅边缘-脚本开发-PS插件
  2. Photoshop Elements 2022 Mac(简化版ps图像编辑软件)内附完整教程
  3. 【Python】第6次练习:叠加等边三角形、正n边形、五角星的绘制
  4. 浅谈餐饮业如何实施ERP(转)
  5. python模拟密码有效性检测功能_Python模拟登陆 —— 征服验证码 3 CSDN-阿里云开发者社区...
  6. 英语中的定义单词(Defining Vocabulary)
  7. Lammps 关于初始化速度的分布问题
  8. 【Unity】摄像机锁定z轴
  9. 路由器和无线路由器的区别
  10. 从0开始,突破难点,宜盟费控将怎样成为企业费控领域的搅局者