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. C-代码笔记-输入输出

    .ACSII 字符实质和整数存储方式相同 //2018年9月16日01:35:54 # include <stdio.h> int main(void) { '; // printf(&q ...

  2. OC与JS的交互(iOS与H5混编)

    大神总结WKWebView的坑:https://mp.weixin.qq.com/s/rhYKLIbXOsUJC_n6dt9UfA 在开发过程中,经常会出现需要iOS移动端与H5混编的使用场景. iO ...

  3. NOIP模拟赛20180917 隐藏题目

    给定n个数,值域范围1~n,每个数都不同,求满足所有相邻数不同的排列数.\(n\le 30\). 状压DP很好想,然而我考试时没写出来.对于排列还是有很多转化方法.另外要注意数据范围.

  4. 12.8 Daily Scrum

    最近大家都比较忙,任务今天也才刚刚分配,所以具体的编码任务从明天开始.   Tomorrow's Task 丁辛 完善餐厅列表,显示距离.             邓亚梅          美化搜索框 ...

  5. 实验五 TCP传输及加密

    实验内容: 1.运行教材上TCP代码,结对进行,一人服务器,一人客户端: 2.利用加解密代码包,编译运行代码,一人加密,一人解密: 3.集成代码,一人加密后通过TCP发送: 注:加密使用AES或者DE ...

  6. HDU 2087 剪花布条 (字符串哈希)

    http://acm.hdu.edu.cn/showproblem.php?pid=2087 Problem Description 一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图 ...

  7. jQuery中empty与html("")的区别对比

    简单的说empty,首先循环给后代元素移除绑定(释放内存).清除jquery给此dom的cache,然后循环removeFirstChild,而html(''),则是简单暴力的设置innerHTML ...

  8. python之打印日志logging

    import logging # 简单打印日志举例 logging.basicConfig(level=logging.DEBUG) # 设置日志级别,WARN logging.warning('Wa ...

  9. 10 月 30 日新款 Mac mini 有望与新款 iPad Pro 一起发布

    苹果最新款的 Mac mini 是在 2014 年 10 月推出的版本,到现在已经过了 4 年.分析师郭明錤和彭博社的 Mark Gurman 都表示苹果会在今年晚些时候发布新款 Mac mini. ...

  10. day29 __eq__ 比较

    本质上 "==" 调用的内部方法就是 __eq__() 正常情况下,两个名字相同的变量比较的是内存地址,内存地址当然是不一样的可以使用__eq__来改变成名字相同就相等 1 cla ...