acm steps1.2.8(Identity Card)
来源:互联网 发布:龙与地下城 知乎 编辑:程序博客网 时间:2024/05/24 06:02
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).
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.
1330000198910120036
He/She is from Zhejiang,and his/her birthday is on 10,12,1989 based on the table.
代码:
#include<iostream>
#include<string>
#include<cstring>
#include<iomanip>
#include<cstdio>
using namespace std;
int main()
{
int n;
string str,prov;
cin>>n;
getline(cin,str);///由于读入n之后没有处理换行,这个getline用于吸收换行符
while(n>0)
{
n--;
getline(cin,str);
switch(str[0])
{
case '3':
if(str[1]=='3')
prov="Zhejiang";
else
prov="Shanghai";
break;
case '1':
prov="Beijing";
break;
case '7':
prov="Taiwan";
break;
case '8':
if(str[1]=='1')
prov="Hong Kong";
else
prov="Macao";
break;
case '5':
prov="Tibet";
break;
case '2':
prov="Liaoning";
break;
}
cout<<"He/She is from "<<prov<<",and his/her birthday is on "<<str[10]<<str[11]<<','<<str[12]<<str[13]<<','<<str[6]<<str[7]<<str[8]<<str[9]<<" based on the table."<<endl;
}
return 0;
}
- acm steps1.2.8(Identity Card)
- 杭电ACM 2629: Identity Card
- 【HDOJ】acm steps1.2.2
- acm steps1.3.5(排序)
- Identity Card
- Identity Card
- Identity Card
- Identity Card
- 杭电 acm steps1.1.2
- 【hdoj】ACM steps1.2.1(代码)
- hdoj acm steps1.2.5(IBM Minus One)
- 杭电 Identity Card
- HDU2629:Identity Card
- 1409210819-hd-Identity Card
- HDOJ 2629 Identity Card
- 2629 Identity Card
- 八、Identity Card
- HDU2629 Identity Card
- HDU-#1286 找新朋友(欧拉函数+计数问题)
- cdecl、stdcall、fastcall函数调用约定区别
- Java中的日志处理
- POJ3077 Rounders
- cocos2dx 帧动画的两种创建方式
- acm steps1.2.8(Identity Card)
- poj 3274 Gold Balanced Lineup, 链地址hash
- POJ 2318 TOYS
- 如何用OpenCV训练自己的分类器
- android 动画切换效果
- UITableView and presentViewController takes 2 clicks to display
- android View的一些学习记录
- Redis在windows下的安装使用
- Java Compilation Process