【PAT B 1014】福尔摩斯的约会

#include 
#include 
#include 
using namespace std;
const int maxn = 1005;
int main() {
    char list[4][65];
    char Date[7][10] = {"MON","TUE","WED","THU","FRI","SAT","SUN"};
    int date = 0,hour = 0,min = 0;
    bool isfirst = true,isfind = false,ischeck = false;
    for(int i = 0;i < 4;i++)
        cin >> list[i];

    for(int i = 0;i < 60;i++){

        if(!isfirst && !ischeck){
            if(list[0][i] == list[1][i]){
                if(('0' <= list[0][i]) && (list[0][i] <= '9')) {
                    hour = list[0][i] - '0';
                    ischeck = true;
                }
                else if(('A' <= list[0][i]) && (list[0][i] <= 'N')){
                    hour = list[0][i] - 'A' + 10;
                    ischeck = true;
                }
            }
        }

        if((list[0][i] == list[1][i]) && isfirst) {
            if (('A' <= list[0][i]) && (list[0][i] <= 'G')) {
                date = list[0][i] - 'A';
                isfirst = false;
            }
        }

        if((list[2][i] == list[3][i]) && !isfind) {
            if((('A' <= list[2][i]) && (list[2][i] <= 'Z')) || (('a' <= list[2][i]) && (list[2][i] <= 'z'))){
                min = i;
                isfind = true;
            }
        }
    }

    printf("%s %02d:%02d",Date[date],hour,min);
    return 0;
}

你可能感兴趣的:(【PAT B 1014】福尔摩斯的约会)