**题目:
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.
代码:**

#include<iostream>#include<string>using namespace std;
string s;
int main(){string region,day,month,year;int k;cin>>k;getline(cin,s);//用于吸收换行 while(k--){getline(cin,s); string str=s.substr(0,2);if(str=="33"){region="Zhejiang";}else if(str=="11"){region="Beijing";}else if(str=="71"){region="Taiwan";}else if(str=="81"){region="Hong Kong";}else if(str=="82"){region="Macao";}else if(str=="54"){region="Tibet";}else if(str=="21"){region="Liaoning";}else if(str=="31"){region="Shanghai";}year=s.substr(6,4);month=s.substr(10,2);day=s.substr(12,2);cout<<"He/She is from "<<region<<",and his/her birthday is on "<<month<<","<<day<<","<<year<<" based on the table."<<endl;}return 0;
}

分析:这一题关键在于输入字符串之前要处理掉输入k之后的那个换行,否则会留在缓冲区影响结果。

【acm2629】 Identity Card相关推荐

  1. 【2629】Identity Card 【比较坑 / 水题】

    http://acm.hdu.edu.cn/showproblem.php?pid=2629 地区只要看前两位就可以了,因为地区是个大的概念后面的数字代表的是县 #include<cstdio& ...

  2. 【WinCE】SD card技术了解并WINCE下SDHC驱动开发(updated)

    SD Card Driver on ADS Summary 了解SD card. 1 WinCE 5.0下SD Stack. 6 Bus Driver 7 Host Controller Driver ...

  3. 【前端】ionic4 card卡片显示随机颜色

    前言      小编在前端项目中,需要将不同的作答记录信息卡片,显示不同的颜色,这个效果用到了随机器的生成和typeScript中的集合,以及html中的[ngStyle]属性. 卡片随机颜色实现记 ...

  4. 【转】SD Card - UHS-I UHS Speed Class 1

    数码玩家们近几年来都已经习惯,用卡面的标识来区分SDHC卡的速度水平和档次,Class 2代表入门级,Class 4和Class 6速度逐步提升,最新的Class 10则代表了顶级SDHC/SD卡.不 ...

  5. 【整理】一堆磨人の数学概率期望

    都是水题 = = ↑ 这四个字太能概括一切了 [1] ZOJ 3785 What day is that day? (找规律) 题意:求11 + 22 + 33 + ... + NN  mod 7 的 ...

  6. 【ASP.NET Identity系列教程(三)】Identity高级技术

    注:本文是[ASP.NET Identity系列教程]的第三篇.本系列教程详细.完整.深入地介绍了微软的ASP.NET Identity技术,描述了如何运用ASP.NET Identity实现应用程序 ...

  7. 【STM32】STM32 SDIO SD卡读写测试(三)-- SD_Init之Init Card阶段

    相关文章 <[SDIO]SDIO.SD卡.FatFs文件系统相关文章索引> 1. 前言 本篇文章主要是介绍stm324x9i_eval_sdio_sd.c里面SD_Init()函数完整的过 ...

  8. 【海思篇】【Hi3516DV300】二、使用串口烧写映像

    目的:将上一章节编译出的映像文件烧写到板子上:让更多的爱好者了解海思.加入海思. 目录 1 准备工作 2 开始烧写 3 配置启动参数 4 结果 1 准备工作 1)准备海思工具HiTool.exe,启动 ...

  9. 【linux】软件管理

    linux软件管理 文章目录 linux软件管理 桥接模式下配置虚拟机连接互联网 nmcli相关命令 windows和linux之间的FTP linux中的软件包类型 rpm相关命令 搭建本地软件仓库 ...

最新文章

  1. Java刷题知识点之进程和线程的区别
  2. 安装java时,配置环境变量classpath的作用
  3. IdentityServer4【QuickStart】之使用asp.net core Identity
  4. junit注释_通过此注释改善您的JUnit体验
  5. oracle insert 当前时间_Oracle知识点总结
  6. [Matlab]求解线性方程组
  7. yum 安装jenkins
  8. oracle 没有rlwap,[20140723]安装使用anysql.txt
  9. 《System语言详解》——3. SystemTap脚本的各大组件
  10. 30个Python小游戏,小白练手,我都能玩一天【内附源码】
  11. VC中实现GB2312、BIG5、Unicode编码转换
  12. BP神经网络算法基本原理,BP神经网络算法流程图
  13. IT程序员常去的论坛、社区、网站有哪些?
  14. mysql——时间显示格式 dateformat函数
  15. python证件照_python opencv实现证件照换底的方法
  16. 身份证核验、实名认证接口助力实名制
  17. Hydra 6.4.xx,Hydra程序框架
  18. wampserver橙色解决方法汇总
  19. 为什么一买就跌一卖就涨,主力如何利用AI大数据击穿散户的心理防线?
  20. 优雅编程之这样使用Map,你就“正常”了(三十六)

热门文章

  1. 如何安装打印机驱动程序
  2. matlab 祁彬彬,MATLAB 向量化编程基础精讲
  3. 【信号与系统学习笔记】—— 【周期信号的傅里叶级数表示】之 周期信号傅里叶级数的性质解读
  4. 基本磁盘无法转化为动态磁盘,提示:此对象不支持操作
  5. 物联网技术可以给养老院带来哪些变化
  6. PCB与设备外壳接地问题
  7. SAP HANA XS CDS简介
  8. LZW字典编码(文末附python实现代码)
  9. 数学之美-读书笔记6-10章
  10. Matlab中的参数解析