// One-star problem // Problem 11309 Counting Chaos /* This program is written by Prof. Chua-Huang Huang Department of Information Engineering and Computer Science Feng Chia University Taichung, Taiwan Disclaimer: The programming problem is downloaded from UVa Online Judge (https://uva.onlinejudge.org/). The program solution is provided for helping students to prepare Collegiate Programming Examination (CPE). The author does not guarantee the program is completely correct to pass UVa Online Judge platform or CPE examination platform. This program is not intended for a student to copy only. He/She should practice the programming problem himself/herself. Only use the program solution as a reference. The author is not responsible if the program causes any damage of your computer or personal properties. No commercial use of this program is allowed without the author's written permission. */ #include #include #include // Check palidrome of hours and minutes. Ignore ':' and leading zeros. int is_palindrome(char *HH, char *MM) { char str[5]; int low, high; strcpy(str, HH); // Copy HH to str. strcat(str, MM); // Append MM to str. while (str[0]=='0') strcpy(str, str+1); // Remove all leading zeros. if (str[0]=='\0') strcpy(str, "0"); // Make str to "0", if the time is 00:00. low = 0; // Lower index of str. high = strlen(str) - 1; // High index of str. while (low 00:00. } int main(void) { int cases; // Number of cases. char HH[3]; // Digits for hours. char MM[3]; // Digits for minutes. int i; // Loop variable. scanf("%d", &cases); for (i=0; i