• 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;
    }
  • 相关阅读:
    C# 内存映射研究学习
    js Promise async await 学习研究
    js 字节数组转数字以及数字转字节数组
    C# 生成一个当前程序唯一的短字符串
    C# FileStream 读取大文件时ReadByte和Read的速度对比
    用一个数维护最多32个可叠加状态,比如权限的状态,既有“读”,又有“写”
    大牛干货:100条Unity基础小贴士
    Unity教程之-Unity3d移动平台性能优化专题(12):面板的设置
    Unity ShaderLab学习总结
    (转)【Unity技巧】Unity中的优化技术
  • 原文地址:https://www.cnblogs.com/RootVount/p/10366237.html
Copyright © 2020-2023  润新知