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

 #define _CRT_SECURE_NO_WARNINGS
#include <climits>
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
string Weeks[] = { "MON","TUE","WED","THU","FRI","SAT","SUN" };
int main()
{
string s1, s2,s3,s4;
cin >> s1 >> s2 >> s3 >> s4;
int length1 = s1.length();
int length2 = s2.length();
int i = ;
int h = , m = ;
int flag = ;
int week = ;
while (i<length1&&i<length2)
{
if (flag == )
{
if (s1.at(i) == s2.at(i) && (s1.at(i) >= 'A' && s1.at(i) <= 'G'))
{
week = s1.at(i) - 'A';
flag++;
}
}
else if (flag == )
{
if (s1.at(i) == s2.at(i)&&((s1.at(i) >= 'A' && s1.at(i) <= 'N')||isdigit(s1.at(i)))){
h = (s1.at(i) >= '' && s1.at(i) <= '') ? s1.at(i) - '' : s1.at(i) - 'A' + ;
break;
}
}
i++;
}
i =;
length1 = s3.length();
length2 = s4.length();
while (i < length1&&i<length2)
{
if (s3.at(i) == s4.at(i)&&((s3.at(i)>='a'&&s3.at(i)<='z')||(s3.at(i)>='A'&&s3.at(i)<='Z')))
{
m = i;
break;
}
i++;
}
cout<< Weeks[week];
printf(" %02d:%02d", h, m);
}

1061 Dating (20分)的更多相关文章

  1. PAT 甲级 1061 Dating (20 分)(位置也要相同,题目看不懂)

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

  2. PAT Basic 1014 福尔摩斯的约会 (20 分) Advanced 1061 Dating (20 分)

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

  3. 【PAT甲级】1061 Dating (20 分)

    题意: 给出四组字符串,前两串中第一个位置相同且大小相等的大写字母(A~G)代表了周几,前两串中第二个位置相同且大小相等的大写字母或者数字(0~9,A~N)代表了几点,后两串中第一个位置相同且大小相等 ...

  4. PAT甲级——1061 Dating (20分)

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

  5. 1061. Dating (20)

    #include <stdio.h> #include <map> #include <string.h> #include <ctype.h> usi ...

  6. PAT (Advanced Level) 1061. Dating (20)

    简单模拟. #include<stdio.h> #include<string.h> ],s2[],s3[],s4[]; ][]={"MON ", &quo ...

  7. PAT甲题题解-1061. Dating (20)-字符串处理,水水

    #include <iostream> #include <cstdio> #include <algorithm> #include <string.h&g ...

  8. pat1061. Dating (20)

    1061. Dating (20) 时间限制 50 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Sherlock Holmes ...

  9. 1061 Dating (20 分)

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

随机推荐

  1. 关于beforeRouteEnter中的next()

    beforeRouteEnter(to,from, next){ console.log(this)   //undefined next(vm => { console.log(vm)}) } ...

  2. 创建和存储 cookie

    在这个例子中我们要创建一个存储访问者名字的 cookie.当访问者首次访问网站时,他们会被要求填写姓名.名字会存储于 cookie 中.当访问者再次访问网站时,他们就会收到欢迎词. 首先,我们会创建一 ...

  3. js实践篇:例外处理Try{}catch(e){}

    本文转载至:http://blog.csdn.net/ocean20/article/details/7301008 程序开发中,编程人员经常要面对的是如何编写代码来响应错误事件的发生,即例外处理(e ...

  4. 解决不管其他元素z-index设置多高,都在视频下面的方法

    <div style="z-index:-1"> <embed name="Movie1" src="http://ecards.s ...

  5. 五分钟学Java:如何学习Java面试必考的网络编程

    原创声明 本文作者:黄小斜 转载请务必在文章开头注明出处和作者. 本文思维导图 简介 Java作为一门后端语言,对于网络编程的支持是必不可少的,但是,作为一个经常CRUD的Java工程师,很多时候都不 ...

  6. PLINQ 并行操作Linq

    C#并行编程-PLINQ:声明式数据并行   目录 C#并行编程-相关概念 C#并行编程-Parallel C#并行编程-Task C#并行编程-并发集合 C#并行编程-线程同步原语 C#并行编程-P ...

  7. KEIL编译出现错误“source file is not valid utf-8”

    实际情况是: .h文件一直报错source file is not valid utf-8的错误, 原因就是: 文件中出现了一个中文的“:”导致的.总结就是:如出现此类错误,可能是字符不够标准.

  8. 998. 最大二叉树 II

    最大树定义:一个树,其中每个节点的值都大于其子树中的任何其他值. 给出最大树的根节点 root. 就像之前的问题那样,给定的树是从表 A(root = Construct(A))递归地使用下述 Con ...

  9. 《Python学习手册 第五版》 -第18章 参数

    在函数的定义和调用中,参数是使用最多喝最频繁的,本章内容就是围绕函数的参数进行讲解 本章重点内容如下: 1.参数的传递 1)不可变得参数传递 2)可变得参数传递 2.参数的匹配模式 1)位置次序:从左 ...

  10. 如何使用Postman编写Testlink测试用例

    Postman2Testlink 通过Postman快速操作testlink测试用例.测试套件.测试计划.添加关键词.添加自定义字段等等. 工具地址 https://github.com/liyinc ...