SDNU 1274.Identity Card

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 14 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.

Here is Susan‘s ID number 370101198910120036 can you tell where he is from?The first 6 numbers tell that he is from Jinan ,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

2
370101198910120036
371101198802150041

Sample Output

He/She is from Jinan,and his/her birthday is on 10,12,1989 based on the table.
He/She is from Rizhao,and his/her birthday is on 02,15,1988 based on the table.
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>

using namespace std;

#define ll long long

int main()
{
    string id;
    int number[20], n;
    scanf("%d", &n);
    for(int i = 0; i<n; i++)
    {
        cin >> id;
        for(int j = 0; j<18; j++)
        {
            number[j] = id[j]-‘0‘;
        }
        if(number[0]==3&&number[1]==7&&number[2]==0&&number[3]==1&&number[4]==0&&number[5]==1)
            printf("He/She is from Jinan,and his/her birthday is on %d%d,%d%d,%d%d%d%d based on the table.\n", number[10],number[11],number[12],number[13],number[6],number[7],number[8],number[9]);
        else if(number[0]==3&&number[1]==7&&number[2]==0&&number[3]==2&&number[4]==0&&number[5]==1)
            printf("He/She is from Qingdao,and his/her birthday is on %d%d,%d%d,%d%d%d%d based on the table.\n", number[10],number[11],number[12],number[13],number[6],number[7],number[8],number[9]);
        else if(number[0]==3&&number[1]==7&&number[2]==0&&number[3]==3&&number[4]==0&&number[5]==1)
            printf("He/She is from Zibo,and his/her birthday is on %d%d,%d%d,%d%d%d%d based on the table.\n", number[10],number[11],number[12],number[13],number[6],number[7],number[8],number[9]);
        else if(number[0]==3&&number[1]==7&&number[2]==1&&number[3]==4&&number[4]==0&&number[5]==1)
            printf("He/She is from Dezhou,and his/her birthday is on %d%d,%d%d,%d%d%d%d based on the table.\n", number[10],number[11],number[12],number[13],number[6],number[7],number[8],number[9]);
        else if(number[0]==3&&number[1]==7&&number[2]==1&&number[3]==0&&number[4]==0&&number[5]==1)
            printf("He/She is from Weihai,and his/her birthday is on %d%d,%d%d,%d%d%d%d based on the table.\n", number[10],number[11],number[12],number[13],number[6],number[7],number[8],number[9]);
        else if(number[0]==3&&number[1]==7&&number[2]==0&&number[3]==6&&number[4]==0&&number[5]==1)
            printf("He/She is from Yantai,and his/her birthday is on %d%d,%d%d,%d%d%d%d based on the table.\n", number[10],number[11],number[12],number[13],number[6],number[7],number[8],number[9]);
        else if(number[0]==3&&number[1]==7&&number[2]==1&&number[3]==1&&number[4]==0&&number[5]==1)
            printf("He/She is from Rizhao,and his/her birthday is on %d%d,%d%d,%d%d%d%d based on the table.\n", number[10],number[11],number[12],number[13],number[6],number[7],number[8],number[9]);
        else if(number[0]==3&&number[1]==7&&number[2]==0&&number[3]==9&&number[4]==0&&number[5]==1)
            printf("He/She is from Taian,and his/her birthday is on %d%d,%d%d,%d%d%d%d based on the table.\n", number[10],number[11],number[12],number[13],number[6],number[7],number[8],number[9]);
        else if(number[0]==3&&number[1]==7&&number[2]==1&&number[3]==2&&number[4]==0&&number[5]==1)
            printf("He/She is from Laiwu,and his/her birthday is on %d%d,%d%d,%d%d%d%d based on the table.\n", number[10],number[11],number[12],number[13],number[6],number[7],number[8],number[9]);
    }
    return 0;
}

原文地址:https://www.cnblogs.com/RootVount/p/10366237.html

时间: 2024-10-08 09:41:41

SDNU 1274.Identity Card的相关文章

Identity Card(水题)

Identity Card Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2696    Accepted Submission(s): 1048 Problem Description Do you own an ID card?You must have a identity card number in your family'

Identity Card(hdu2629)

输入方式:先输入一个整型,再输入不带空格的字符串. 思考:先输入不带空格的字符串,用scanf_s()函数,遇到空格默认字符串输入停止.前提,以数组身份逐个循环输入. #include<stdio.h> #include<iostream> #include<string.h> using namespace std; int main() { int n; char d; scanf("%d%c", &n, &d); while (

杭电acm Identity Card

题目链接:http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=1&sectionid=2&problemid=25 好的吧,不得不说我因为一个Hone Kong卡了好几个小时,改来改去,使用了几种方式:1,使用hashmap保存所有的表格的数据,将身份证头两位.年.月.日转换成整数.2,使用hashmap只转换头两位,其余直接从身份证中取.3,纯粹使用网上的方法,直接将身份证的字符串输出,都是wrong answer,直到

杭电2629 Identity Card

题目意思很简单,就是根据身份证号码来确定一个人的籍贯和生日,(然而我开始脑子抽了还以为还要根据奇数偶数判断男女233333). 然后我的暴力ac代码: 1 #include <iostream> 2 #include<math.h> 3 #include <iomanip> 4 #include<cstdio> 5 #include<string> 6 #include<map> 7 #include<vector> 8

【干货】免费获得WebStorm软件

内容提要: 1.WebStorm简介 2.如何免费获得WebStorm 3.利用学生身份免费获得正式版WebStorm WebStorm简介 WebStorm 是一款前端开发 IDE(集成开发环境),可以简单理解为,它是一个智能的.强大的代码编辑器. 小编不是Web前端高手,因为要开发HTML5小游戏和使用Egret引擎,巧合之下接触了WebStorm,使用之后感觉真的不错,所以推荐给大家. WebStorm是JetBrains 公司旗下的商业软件产品,该公司还提供了 PhpStorm 和 In

ELF解析(part one)

the contents class elf { //date structure Elf32_Ehdr ehdr; Elf32_Shdr shdr; Elf32_Phdr phdr; // void elf( void); void ~elf( void); void ehdr(void); void shdr(void); void phdr(void); void StringTable(void); void SymbolTable(void); void Relocation(void

身份证

LOAD DATA LOW_PRIORITY LOCAL INFILE 'C:\\Users\\neo\\Desktop\\id.csv' INTO TABLE `identity_card` FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' (`number`, `zone`); CREATE TEMPORARY TABLE tmp1 select * from identity_card where number like '%0000'

对一个前端使用AngularJS后端使用ASP.NET Web API项目的理解(2)

chsakell分享了一个前端使用AngularJS,后端使用ASP.NET Web API的项目. 源码: https://github.com/chsakell/spa-webapi-angularjs文章:http://chsakell.com/2015/08/23/building-single-page-applications-using-web-api-and-angularjs-free-e-book/ 这里记录下对此项目的理解.分为如下几篇: ● 对一个前端使用AngularJ

「豆瓣时间」

变着花样,「豆瓣时间」的广告页已经在豆瓣App上轮播了一周.豆瓣er们被雨果.普希金.菏尔德林等大师邀请了那么多天,终于在今天见到这档付费音频节目的真面目. 今天是2017年3月7日,距分答上线近一年,距喜马拉雅FM“123知识狂欢节”过去3个月.如今,罗胖正在炮制概念的路上狂奔,知乎已然形成付费矩阵,科技媒体Pro版遍地开花. 以文艺青年为主要用户群的豆瓣,却还是秉持“慢工出细活”的态度,除了原创+打赏的标配功能,去年最大的动作就是阿北宣布要进军影业.虽然每个行为都指向内容,但都没真正涉及支付