1061. Dating

Source: Internet
Author: User

Sherlock Holmes received a note with some strange strings: "Let's date!" 3485djdkxh4hhge 2984AKDFKKKKGGEDSB s&hgsfdk d&hyscvnm ". It took him only a minute to figure out that those strange strings is actually referring to the coded time "Thursday 14:0 4 "--since the first common capital 中文版 (case sensitive) shared by the first and strings is the 4th capital Le Tter ' D ', representing the 4th day in a week; The second common character is the 5th capital letter ' E ', representing the 14th hour (hence the hours from 0 to + a D Ay is represented by the numbers from 0 to 9 and the capital letters from A to N, respectively); and the Chinese letter gkfx by the last of the strings is ' s ' at the 4th position, representing the 4th minute. Now given and pairs of strings, you is supposed to help Sherlock decode the dating time.

Input Specification:

Each input file contains the one test case. Each case gives 4 non-empty strings of no more than, characters without white space in 4 lines.

Output Specification:

For each test case, print the decoded time on one line, in the format ' Day hh:mm ', where ' Day ' is a 3-character abbreviati On for the days in a week--that's, ' MON ' for Monday, ' TUE ' for Tuesday, ' WED ' for Wednesday, ' THU ' for Thursday, ' FRI ' For Friday, ' SAT ' for Saturday, and ' SUN ' for Sunday. It is guaranteed, the result is a unique for each case.


Really torture people, the line has been dragged all the time, before said 8th, now said 11th, can not imagine what kind of mood to finish this question

#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 65bool Check1 (char A,char b); bool Check2 (char A,char b); bool Check3 (char A,char b); void Day (char a); void Hour (char a); int main () {char First[n],seco    Nd[n],third[n],forth[n];    Gets (first);    Gets (second);    Gets (third);    Gets (forth);    int Len1=strlen (first), Len2=strlen (second), Len3=strlen (third), Len4=strlen (forth);    int i,j;         for (i=0;i<len1&&i<len2;i++) {if (Check1 (First[i],second[i])) break;     } day (First[i]);    i++;         for (; i<len1&&i<len2;i++) {if (Check2 (First[i],second[i])) break;    } Hour (First[i]);         for (i=0;i<len3&&i<len4;i++) {if (Check3 (Third[i],forth[i])) break;    } printf (":%.2d\n", i);    System ("pause");    return 0;         }void Hour (char a) {if (A-' 0 ' >=0&&a-' 9 ' <=0) {printf ("%.2d", A-' 0 '); } else printf ("%.2d", A-' a ' +10);            }void Day (char a) {switch (a) {case ' a ':p rintf ("MON"); return;            Case ' B ':p rintf ("TUE"); return;            Case ' C ':p rintf ("WED"); return;            Case ' D ':p rintf ("THU"); return;            Case ' E ':p rintf ("FRI"); return;            Case ' F ':p rintf ("SAT"); return;            Case ' G ':p rintf ("SUN"); return;         }}bool Check1 (char A,char b) {if (a-b==0) {if (A-' a ' >=0 && a ' G ' <=0) return true;         else return false;     } else return false; } bool Check2 (char A,char b) {if (a-b==0) {if ((A-' 0 ' >=0 &&a-' 9 ' <=0) | | (A-' a ' >=0&&a-' N ' <=0))         return true;         else return false;     } else return false;         } bool Check3 (char A,char b) {if (a-b==0) {if (A-' a ' >=0&&a-' z ' <=0) return true;         else return false;     } return false;  }


1061. Dating

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.