Identity Card
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).
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.
1 330000198910120036
He/She is from Zhejiang,and his/her birthday is on 10,12,1989 based on the table.
为了使得代码看起来简练一些,用数组来回对应,郁闷了.......
不过看起来还是好恶心的感觉...............
#include<stdio.h>
char *city[10]=
{"","Zhejiang","Beijing","Taiwan","Hong Kong",
"Macao","Tibet","Liaoning","Shanghai"};
int vis[9][9];
int main()
{
vis[3][3]=1;vis[1][1]=2;vis[7][1]=3;vis[8][1]=4;
vis[8][2]=5;vis[5][4]=6;vis[2][1]=7;vis[3][1]=8;
int t;char s[25];
scanf("%d",&t);
while(t--)
{
scanf("%s",s);
printf("He/She is from %s,and his/her birthday is on %c%c,%c%c,%c%c%c%c based on the table.\n"
,city[vis[s[0]-'0'][s[1]-'0']],s[10],s[11],s[12],s[13],s[6],s[7],s[8],s[9]);
}
return 0;
}
2116




被折叠的 条评论
为什么被折叠?



