标签:char print div a10 turn scan flag har ==
1 #include<cstdio> 2 #include<cstring> 3 int main(){ 4 char str1[61], str2[61], str3[61], str4[61]; 5 char week[7][4]={"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"}; 6 scanf("%s", &str1); 7 scanf("%s", &str2); 8 scanf("%s", &str3); 9 scanf("%s", &str4); 10 int len1 = strlen(str1), len3 = strlen(str3); 11 bool flag = false; 12 for(int i = 0; i < len1; i++){ 13 if(flag == false && str1[i] == str2[i] && str1[i]>‘A‘ && str1[i]<‘G‘){ 14 printf("%s ", week[str1[i] - ‘A‘]); 15 flag = true; 16 continue; 17 } 18 if(flag == true && str1[i] == str2[i]) { 19 if(str1[i] >= ‘0‘ && str1[i] <= ‘9‘) { 20 printf("%02d:", str1[i] - ‘0‘); 21 break; 22 } 23 if(str1[i] >= ‘A‘ && str1[i] <= ‘N‘) { 24 printf("%02d:", str1[i] - ‘A‘ + 10); 25 break; 26 } 27 } 28 } 29 for(int i= 0; i < len3; i++){ 30 if(str3[i] == str4[i] && ((str3[i] >= ‘a‘ && str3[i] <= ‘z‘)||(str3[i] >= ‘A‘ && str3[i] <= ‘Z‘))){ 31 printf("%02d",i); 32 break; 33 } 34 } 35 return 0; 36 }
PAT 甲级 A1061 (2019/02/09) NULL(16/20)
标签:char print div a10 turn scan flag har ==
原文地址:https://www.cnblogs.com/zjsaipplp/p/10415813.html