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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值