hdu ACM steps 1.2.7 hdu 2629
2017-01-17 14:19
295 查看
题目大意:
根据身份证号按格式输出省份和生日
大致思路:
身份证号不能当成一个数字来存,用getchar()
c:
根据身份证号按格式输出省份和生日
大致思路:
身份证号不能当成一个数字来存,用getchar()
c:
#include<stdio.h> int main() { int id[20],N; scanf("%d",&N); while(N--) { getchar(); //每次测试都能够吃掉回车 for(int i=1;i<=18;i++) { char c=getchar(); id[i]=c-'0'; } printf("He/She is from "); int m=id[1]*10+id[2]; switch(m) { case 33: printf("Zhejiang"); break; case 11: printf("Beijing"); break; case 71: printf("Taiwan"); break; case 81: printf("Hong Kong"); break; case 82: printf("Macao"); break; case 54: printf("Tibet"); break; case 21: printf("Liaoning"); break; case 31: printf("Shanghai"); break; } printf(",and his/her birthday is on %d%d,%d%d,%d%d%d%d based on the table.\n",id[11],id[12],id[13],id[14],id[7],id[8],id[9],id[10]); } return 0; }
相关文章推荐
- hdu ACM STEPS 1.2.7
- hdu ACM steps 1.3.4 hdu 2561
- hdu acm steps 2.1.8
- hdu acm steps 2.2.8
- hdu 1071 ACM steps The area
- HDU ACM Steps 攻略
- hdu-acm steps Common Subsequence
- hdu ACM Steps 做题笔记(Chapter One)
- hdu ACM Steps 做题笔记(Chapter Two)(Section 1)
- hdu acmsteps 2.2
- hdu ACM steps 1.2.5 hdu3188
- HDU ACM Steps 1.2.1 hide handkerchief
- hdu acm steps 1.3.1
- hdu acm steps 1.3.2
- hdu-acm steps Monkey and Banana
- hdu acmsteps 2.1
- hdu ACM steps 1.2.6 hdu3361
- hdu acm steps 2.1
- hdu acm steps 1.3.3
- hdu ACMSteps 5.3.8 Rotate