大侦探福尔摩斯接到一张奇怪的字条:我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm。大侦探很快就明白了,字条上奇怪的乱码实际上就是约会的时间星期四 14:04,因为前面两字符串中第 1 对相同的大写英文字母(大小写有区分)是第 4 个字母 D,代表星期四;第 2 对相同的字符是 E ,那是第 5 个英文字母,代表一天里的第 14 个钟头(于是一天的 0 点到 23 点由数字 0 到 9、以及大写字母 A 到 N 表示);后面两字符串第 1 对相同的英文字母 s 出现在第 4 个位置(从 0 开始计数)上,代表第 4 分钟。现给定两对字符串,请帮助福尔摩斯解码得到约会的时间。

输入格式:

输入在 4 行中分别给出 4 个非空、不包含空格、且长度不超过 60 的字符串。

输出格式:

在一行中输出约会的时间,格式为 DAY HH:MM,其中 DAY 是某星期的 3 字符缩写,即 MON 表示星期一,TUE 表示星期二,WED 表示星期三,THU 表示星期四,FRI 表示星期五,SAT 表示星期六,SUN 表示星期日。题目输入保证每个测试存在唯一解。

输入样例:

3485djDkxh4hhGE
2984akDfkkkkggEdsb
s&hgsfdk
d&Hyscvnm

输出样例:

THU 14:04

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<iostream>
using namespace std;
int convHH(char value){
if(value>='A'&&value<='N') return value-'A'+;
else return value-'';
}
string convDay(char value){
switch(value){
case 'A':return "MON";
case 'B':return "TUE";
case 'C':return "WED";
case 'D':return "THU";
case 'E':return "FRI";
case 'F':return "SAT";
case 'G':return "SUN";
}
}
int main() {
string a,b,c,d;
cin>>a>>b>>c>>d;
int m=;
char DAY,HH;
for(int i=;i<a.length();i++,m++){
if(a[m]==b[m]&&(a[m]>='A'&&a[m]<='G')){/**缩小范围到A-G*/
DAY=a[m];
break;
}
}
m++;
for(int i=m;i<a.length();i++,m++){
if(a[m]==b[m]&&((a[m]>='A'&&a[m]<='N')||(a[m]>=''&&a[m]<=''))){
HH=a[m];
break;
}
}
for(int i=;i<c.length();i++){
if(c[i]==d[i]&&((c[i]>='A'&&c[i]<='Z')||(c[i]>='a'&&c[i]<='z'))){
m=i;
break;
}
}
cout<<convDay(DAY)<<" ";
printf("%02d:%02d",convHH(HH),m);
system("pause");
return ;
}

PAT Basic 1014 福尔摩斯的约会 (20 分) Advanced 1061 Dating (20 分)的更多相关文章

  1. PAT Basic 1014 福尔摩斯的约会 (20 分)

    大侦探福尔摩斯接到一张奇怪的字条:我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm.大侦探很快就明白了,字条上奇 ...

  2. PAT乙级 1014. 福尔摩斯的约会 (20)

    1014. 福尔摩斯的约会 (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 大侦探福尔摩斯接到一张奇怪的 ...

  3. PAT 乙级 1014 福尔摩斯的约会 (20) C++版

    1014. 福尔摩斯的约会 (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 大侦探福尔摩斯接到一张奇怪的 ...

  4. 【PAT】1014. 福尔摩斯的约会 (20)

    1014. 福尔摩斯的约会 (20) 大侦探福尔摩斯接到一张奇怪的字条:“我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hy ...

  5. PAT(B) 1014 福尔摩斯的约会(Java)

    题目链接:1014 福尔摩斯的约会 注意 三个字眼:"第1对","第2对","第1对",因此如果你用了循环,别忘了break,因为后面也可能 ...

  6. PAT 乙级 -- 1014 -- 福尔摩斯的约会

    题目简介 大侦探福尔摩斯接到一张奇怪的字条:"我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm&quo ...

  7. PAT (Basic Level) Practice (中文)1014 福尔摩斯的约会 (20分)

    1014 福尔摩斯的约会 (20分) 带侦探福尔摩斯接到一张奇怪的字条:我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hys ...

  8. PAT乙级:1014 福尔摩斯的约会 (20分)

    PAT乙级:1014 福尔摩斯的约会 (20分) 题干 大侦探福尔摩斯接到一张奇怪的字条:我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk ...

  9. PAT (Basic Level) Practise (中文)- 1014. 福尔摩斯的约会 (20)

    http://www.patest.cn/contests/pat-b-practise/1014 1014. 福尔摩斯的约会 (20) 时间限制 50 ms 内存限制 65536 kB 代码长度限制 ...

随机推荐

  1. [LeetCode]-algorithms-Longest Substring Without Repeating Characters

    Given a string, find the length of the longest substring without repeating characters. For example, ...

  2. python正则之特殊表达式 .*?{}

    . 能匹配所有字符--单个字符,除了\n >>> re.match(r".","1") <_sre.SRE_Match object a ...

  3. IView入门练习~CDN模式全局加载JS

    关于 iView iView 是一套基于 Vue.js 的开源 UI 组件库,主要服务于 PC 界面的中后台产品. 特性 高质量.功能丰富 友好的 API ,自由灵活地使用空间 细致.漂亮的 UI 事 ...

  4. 每日踩坑 2019-08-23 button 元素点击后刷新页面

    button标签按钮会提交表单. 解决方案: <button class="btn btn-primary" type="button" id=" ...

  5. SRCNN 卷积神经网络

    2019-05-19 从GitHub下载了代码(这里) 代码量虽然不多,但是第一次学,花了时间还是挺多的.根据代码有跑出结果(基本没有改),但是对于数据集的处理还是看的很懵逼,主要是作者的实现都是用类 ...

  6. NLP大赛冠军总结:300万知乎多标签文本分类任务(附深度学习源码)

    NLP大赛冠军总结:300万知乎多标签文本分类任务(附深度学习源码)       七月,酷暑难耐,认识的几位同学参加知乎看山杯,均取得不错的排名.当时天池AI医疗大赛初赛结束,官方正在为复赛进行平台调 ...

  7. 获取免费的https证书

    可以通过网站获取免费的https证书 首先到https://freessl.org注册一个账号 然后就可以开始创建免费证书了 获取的证书里面通常只有pem后缀文件 nodejs使用的时候需要crt文件 ...

  8. 原生js去除行内样式

    概述 今天我用js给dom元素设置样式,碰到了一些问题,记下来供以后开发时参考,相信对其他人也有用. 心得 js加上class: $dom.classList.add('some-class'); j ...

  9. TCP 首部格式

    <图解TCP/IP> 6.7  TCP的首部格式 TCP中没有表示包长度和数据长度的字段.可由IP层获知TCP的包长由TCP的包长可知数据的长度. 源端口号:表示发送端端口号,字段长16位 ...

  10. Jmeter 后置处理器--jp@gc - JSON/YAML Path Extractor & JSON Extractor

    后置处理器--jp@gc - JSON/YAML Path Extractor 1.需要下载插件,地址: 解压后把对应jar包放置对应的lib和lib/ext目录下,重启Jmeter: 2.在需要提取 ...