HDU 2629 Identity Card
简单题
给出身份证号 判断住址 和出生年月
熟练字符串的操作
主要是string::substr(s, l)//s:起始位置 l长度
#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <map>
#include <fstream> using namespace std; map<string,string> m;
int main()
{
m[""] = "Zhejiang";
m[""] = "Beijing";
m[""] = "Taiwan";
m[""] = "Hong Kong";
m[""] = "Macao";
m[""] = "Tibet";
m[""] = "Liaoning";
m[""] = "Shanghai";
int T;
freopen("in.txt", "r", stdin);
ifstream cin ("in.txt");
scanf("%d", &T);
getchar();
while (T--)
{
char buff[];
string id, from;
string yy, mm, dd;
gets(buff);
id = buff;
from = id.substr(, );
yy = id.substr(, );
mm = id.substr(, );
dd = id.substr(,);
cout << "He/She is from " << m[from] << ",and his/her birthday is on " <<mm<<"," <<dd <<"," <<yy <<" based on the table."<<endl;
}
}
HDU 2629 Identity Card的更多相关文章
- hdu 2629 Identity Card (字符串解析模拟题)
这题是一个字符串模拟水题,给12级学弟学妹们找找自信的,嘿嘿; 题目意思就是要你讲身份证的上的省份和生日解析出来输出就可以了: http://acm.hdu.edu.cn/showproblem.ph ...
- 杭电2629 Identity Card
题目意思很简单,就是根据身份证号码来确定一个人的籍贯和生日,(然而我开始脑子抽了还以为还要根据奇数偶数判断男女233333). 然后我的暴力ac代码: #include <iostream> ...
- Identity Card(水题)
Identity Card Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) To ...
- HDU2629:Identity Card
Problem Description Do you own an ID card?You must have a identity card number in your family's Hous ...
- HDU 4336:Card Collector(容斥原理)
http://acm.split.hdu.edu.cn/showproblem.php?pid=4336 Card Collector Special Judge Problem Descriptio ...
- 【HDU】4336 Card Collector
http://acm.hdu.edu.cn/showproblem.php?pid=4336 题意:n张卡片,每一次取一个盒子,盒子里装有卡片i的概率是p[i],求得到所有卡片所需要开的盒子的期望数( ...
- HDU - 4336:Card Collector(min-max容斥求期望)
In your childhood, do you crazy for collecting the beautiful cards in the snacks? They said that, fo ...
- hdu 4061 A Card Game
思路: 分析:假设取的牌顺序是一个序列,那么这种序列在末尾为1时是和取牌序列一一对应的,且是符合“游戏结束时牌恰好被取完”的一种情况. 简证:1.在序列中,任一数 i 的后一个数 j 是必然要放在第 ...
- Identity Card(hdu2629)
输入方式:先输入一个整型,再输入不带空格未知长度/已知长度的字符串. 思考:用scanf_s()函数输入整型,再循环输入不带空格未知长度的字符串,用gets_s()函数. 注意:scanf_s()函数 ...
随机推荐
- 4. iOS测试常用方法
1. [XCUIElement exists]方法只能确定这个View是否存在,即使不在当前屏幕上也返回True.如果要确定View是否在屏幕可见范围内,可以判断其Frame是否在Window的 ...
- UOJ#52. 【UR #4】元旦激光炮(交互)
题意 给出三个已经排好序的数组$a, b, c$ 在$100$次询问内找出第$k$小的元素 Sol 一种很显然的$log^2n$的做法:首先在$a$中二分,然后再$b,c$中二分.这样可以得到$60$ ...
- Linux之用户权限管理
chmod(更改目录或文件权限) 在linux中,文件的权限分为3中,拥有者,群组,其他人.而chmod则是对权限更改的命令. u 表示该文件的拥有者,g 表示与该文件的拥有者属于同一个组,o 表示其 ...
- Keil Debug (printf) Viewer
Debug (printf) Viewer Home » µVision Windows » Debug (printf) Viewer The Debug (printf) Viewer windo ...
- jxcel - 好用的Excel与Java对象转换工具
更多精彩博文,欢迎访问我的个人博客 Jxcel简介 Jxcel是一个支持Java对象与Excel(目前仅xlsx.xls)互相转换的工具包. 项目地址:https://github.com/jptan ...
- C++虚析构函数的使用
如果,你设计的程序里,释放对象实例的时候,有“使用某个基类的指针,来释放它指向的派生类的实例”这种用法出现的话,那么,这个基类的destructor就应该设计成virtual的. 如果,基类不是vir ...
- libcmt.lb libcmtd.lib与MSVCRTD.lib的冲突解决
system("pause"); 这个函数存在于MSVCRTD.lib库中: 当要使用system("pause")这个函数,且libcmt.lb libcmt ...
- java生成随机字符
1.生成的字符串每个位置都有可能是str中的一个字母或数字,需要导入的包是import java.util.Random; //length用户要求产生字符串的长度 public static Str ...
- dns config
.: { forward . { force_tcp expire 50s health_check 50s } cache debug errors whoami log } Corefile .: ...
- 内置函数filter和map
filter filter()函数接收一个函数 f 和一个list,这个函数 f 的作用是对每个元素进行判断,返回 True或 False,filter()根据判断结果自动过滤掉不符合条件的元素,返回 ...