zoukankan      html  css  js  c++  java
  • 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;
    }
  • 相关阅读:
    一个小白的进击之路——Hadoop开篇
    日元对人民币汇率的大数据分析与预测
    团队第九次作业-用户使用手册与反馈
    第九次团队作业-测试报告与用户使用手册
    系统设计和任务分配(个人)
    结对项目之需求分析与原型设计
    第五次作业——四则运算
    django-团队简介的网页
    该怎么学好软件工程这门课?
    第九次团队作业-测试报告与用户手册
  • 原文地址:https://www.cnblogs.com/RootVount/p/10366237.html
Copyright © 2011-2022 走看看