HDU 2629
// http://acm.hdu.edu.cn/showproblem.php?pid=2629 #include <stdio.h> void area(char a, char b) { //小技巧 //字符转整形 // int i = int(a - '0'); //字符串转整形 // int i = atoi(str); switch (a) { case '1': printf("Beijing"); break; case '2': printf("Liaoning"); break; case '3': switch (b) { case '1': printf("Shanghai"); break; case '3': printf("Zhejiang"); break; }; break; case '5': printf("Tibet"); break; case '7': printf("Taiwan"); break; case '8': switch (b) { case '1': printf("Hong Kong"); break; case '2': printf("Macao"); break; }; break; } } int main() { int n; char s[19], a; scanf("%d%c", &n, &a); while (n--) { for (int i = 0; i < 19; i++) { scanf("%c", &s[i]); } int k = int(s[16] - '0'); printf("He/She is from "); area(s[0], s[1]); printf(",and his/her birthday is on %c%c,%c%c,%c%c%c%c based on the table.\n", s[10], s[11], s[12], s[13], s[6], s[7], s[8], s[9]); } return 0; }
哇气死了 不用判断性别 真的是