| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 462 人关注过本帖
标题:杭电 ID card....
取消只看楼主 加入收藏
巴克
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:93
专家分:199
注 册:2012-2-8
结帖率:100%
收藏
已结贴  问题点数:14 回复次数:2 
杭电 ID card....
上题:
Problem 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 17 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.

However,in your card,maybe only 33 appears,0000 is replaced by other numbers.
Here is Samuel's ID number 331004198910120036 can you tell where he is from?The first 2 numbers tell that he is from Zhengjiang Province,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

1
330000198910120036

 

Sample Output

He/She is from Zhejiang,and his/her birthday is on 10,12,1989 based on the table.

 
搜索更多相关主题的帖子: next specially represent everyone 
2012-02-23 22:41
巴克
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:93
专家分:199
注 册:2012-2-8
收藏
得分:0 
贴代码
程序代码:
#include<stdio.h>
#include<string.h>
int main()
{
    char ss[16][20] = {"Zhejiang\0","330000\0",
                       "Beijing\0","110000\0",
                       "Taiwan\0","710000\0",
                       "Hong Kong\0","810000\0",
                       "Macao\0","820000\0",
                       "Tibet\0","540000\0",
                       "Liaoning\0","210000\0",
                       "Shanghai\0","310000\0"
                    };
    int i,j,k,ti;
    char str[500][24],place[7],birth[5];
    int n,month,day;
    scanf("%d\n",&n);
    for(i=0;i<n;i++)
    {
        gets(str[i]);
        for(k=0;k<6;k++)
            place[k] = str[i][k];
        place[6] = '\0';
        for(k=6,j=0;k<10;k++,j++)
            birth[j] = str[i][k];
        birth[4] = '\0';
        month = 10*(str[i][10]-'0')+str[i][11]-'0';
        day = 10*(str[i][12]-'0')+str[i][13]-'0';
        for(ti = 0;ti<16;ti++)
        {
            if(strcmp(ss[ti],place)==0)
            {
                printf("He/She is from %s,and his/her birthday is on ",ss[ti-1]);
                printf("%d,%d,%s based on the table.\n",month,day,birth);                   //这里面分行输出时为了美观....
            }
        }
    }

    return 0;
}

2012-02-23 22:42
巴克
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:93
专家分:199
注 册:2012-2-8
收藏
得分:0 
这个代码交上去就是wrong answer
不知为什么??
原题已经AC,开贴问一下这个为什么错了....
2012-02-23 22:43
快速回复:杭电 ID card....
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018283 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved