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 are actually referring to the coded time "Thursday 14:04" -- since the first common capital English letter (case sensitive) shared by the first two strings is the 4th capital letter '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 23 in a day are represented by the numbers from 0 to 9 and the capital letters from A to N, respectively); and the English letter shared by the last two strings is 's' at the 4th position, representing the 4th minute. Now given two pairs of strings, you are supposed to help Sherlock decode the dating time.

Input Specification:

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

Output Specification:

For each test case, print the decoded time in one line, in the format "DAY HH:MM", where "DAY" is a 3-character abbreviation for the days in a week -- that is, "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 that the result is unique for each case.

Sample Input:

3485djDkxh4hhGE
2984akDfkkkkggEdsb
s&hgsfdk
d&Hyscvnm

Sample Output:

THU 14:04
 #include<cstdio>
#include<iostream>
#include<string.h>
using namespace std;
char date[][] = {" ", "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
int w2num(char e){
if(e >= '' && e <= '')
return e - '';
else return e - 'A' + ;
}
int isw(char a){
return a >= 'a' && a <= 'z' || a >= 'A' && a <= 'Z';
}
int main(){
char str[][], ch1 = '\0', ch2;
int count = ;
for(int i = ; i < ; i++)
scanf("%s", str[i]);
for(int i = ; i < strlen(str[]) ; i++){
if(ch1 == '\0' && str[][i] == str[][i] && str[][i] >= 'A' && str[][i] <= 'G'){
ch1 = str[][i];
continue;
}
if(ch1 != '\0' && str[][i] == str[][i] && ((str[][i] >= '' && str[][i] <= '') || (str[][i] >= 'A' && str[][i] <= 'N'))){
ch2 = str[][i];
break;
}
}
for(count = ; str[][count] != '\0' && str[][count] != '\0'; count++)
if(str[][count] == str[][count] && isw(str[][count]))
break;
printf("%s %02d:%02d", date[ch1 - 'A' + ], w2num(ch2), count);
cin >> ch1;
return ;
}

1、第一个星期,选取的是同下标的、大写字母在A-G上的相同字母;第二个小时,是同下标、大写字母在A到N或者是数字的相同字符;第三个分钟是相同字母的下标。容易忽略的是星期的大写字母只有7个,小时的大写字母只有14个。

A1061. Dating的更多相关文章

  1. PAT甲级——A1061 Dating

    Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkg ...

  2. PAT/字符串处理习题集(一)

    B1006. 换个格式输出整数 (15) Description: 让我们用字母B来表示"百".字母S表示"十",用"12...n"来表示个 ...

  3. PAT题目AC汇总(待补全)

    题目AC汇总 甲级AC PAT A1001 A+B Format (20 分) PAT A1002 A+B for Polynomials(25) PAT A1005 Spell It Right ( ...

  4. 1061 Dating (20 分)

    1061 Dating (20 分) Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh ...

  5. hdu 2579 Dating with girls(2)

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=2579 Dating with girls(2) Description If you have sol ...

  6. hdu 2578 Dating with girls(1)

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=2578 Dating with girls(1) Description Everyone in the ...

  7. 10 signs you’re dating the wrong person

    10 signs you’re dating the wrong person10个迹象表明TA不是你的真心人       Do you have any exes who were so awful ...

  8. hdoj 2579 Dating with girls(2)【三重数组标记去重】

    Dating with girls(2) Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Oth ...

  9. Dating with girls(1)(二分+map+set)

    Dating with girls(1) Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Oth ...

随机推荐

  1. 分布式监控系统Zabbix3.4-针对MongoDB性能监控操作笔记

    公司在IDC机房的一台服务器上部署了MongoDB,由于所存储的业务数据比较重要,所以对MongoDB的监控显得尤为重要!Zabbix监控MongoDB性能的原理:通过echo "db.se ...

  2. linux-shell-变量参数

    sxt1 的生命周期随着调起而生效,结束就消失 子进程和父进程的关系,

  3. ecna2017-Game of Throwns

    这题就是给你一个标号为0-n-1的环,然后给你M个操作,操作有两种,一种是直接给一个数,这数的正负代表我当前向前(向后)仍了xx个位置的球,或者给你一个撤销操作表示为 undo m,表示撤销最近的M个 ...

  4. 第六次Scrum meeting

    第六次Scrum  meeting 任务及完成度: 成员 12.21 12.22 陈谋 任务1040:完成stackoverflow的数据处理后的json处理(98%) 任务1114-1:完成对网页数 ...

  5. Java 一维数组作为参数和返回值

    一维数组作为参数: 传数组的引用 创建数组直接传,本质也是传数组的引用 传null public class Test { //数组作为参数时,可以传递3中形式 public void m1(int[ ...

  6. Golang 入门~~基础知识

    变量声明 //通用形式,指定变量名,变量类型,变量值 var name int = 99 fmt.Println(name) //指定变量名,以及变量类型,未指定值的时候默认是类型零值 var age ...

  7. HTML5的placeHolder在IE9下workaround引发的Bug(按下葫芦起了瓢)

    详见StackOverFlow的:Simple jQuery form Validation: Checking for empty .val() failing in ie9 due to plac ...

  8. Spring MVC (Java),强制页面不缓存

    response.setDateHeader("Expires",0);        response.setHeader("Buffer","Tr ...

  9. Hacked VisualSVN Server by PHP to allow user change password

    index.php <?php$username = $_SERVER["PHP_AUTH_USER"]; //经过 AuthType Basic 认证的用户名$authed ...

  10. 【转帖】intel 2018年1 月2号爆出漏洞分析 知乎匿名用户

    作者:匿名用户链接:https://www.zhihu.com/question/265012502/answer/288407097来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载 ...