SDNU 1274.Identity Card

Posted rootvount

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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.
", 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.
", 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.
", 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.
", 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.
", 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.
", 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.
", 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.
", 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.
", number[10],number[11],number[12],number[13],number[6],number[7],number[8],number[9]);
    }
    return 0;
}

 


以上是关于SDNU 1274.Identity Card的主要内容,如果未能解决你的问题,请参考以下文章

SDNU 1279.※N

SDNU 1108.Happy luguans(水题)

sdnu 1513 字符串翻转

SDNU 1125.Let the Balloon Rise

SDNU 1440.字母图形

SDNU 1012.区间合并