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;
    }
  • 相关阅读:
    leetcode401 二进制手表问题
    HashMap与Hashtable
    ideal配置web项目
    java多线程
    spring boot项目启动报错:Failed to load property source from location 'classpath:/application.yml'
    spring cloud实例Dome详细搭建(一)
    ideal激活方法
    Go学习第三章面向对象
    Go学习第二章内建容器
    Go学习第一章基础语法
  • 原文地址:https://www.cnblogs.com/RootVount/p/10366237.html
Copyright © 2011-2022 走看看