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. django 从零开始 6 数据库模型增删改查

    这些都是凭记忆写下的,有些会漏掉,在之后的笔记中会写 和flask query不同,django是使用objects进行一个查询 查询 单条记录 django 模型.bojects.get(查询的字段 ...

  2. 浅谈Java中静态代码块和非静态代码块

    静态代码块: static{} 执行优先级高于非静态的初始化块,它会在类初始化(类初始化这个问题改天再详细讨论)的时候执行一次,执行完成便销毁,它仅能初始化类变量,即static修饰的数据成员. 非静 ...

  3. JAVA设计模式之-模板方法+(钩子函数)

    1.定义 允许子类对父类的一个或多个步骤进行重写.例如聚合支付场景中有很多共同的步骤,比如验签.四要素验证.风控等等,但是在支付的时候走不同的渠道可能在调用和参数上有很大的不同,比如有的是xml,有的 ...

  4. CSS核心概念之盒子模型

    盒子模型(Box Model) 关于更多CSS核心概念的文章请关注GitHub--CSS核心概念. 当对一个文档进行布局的时候,浏览器的渲染引擎会根据标准之一的 CSS 基础框盒模型(CSS basi ...

  5. Spring Ioc 依赖查找

    Spring ioc 有依赖查找和依赖注入,之前不太明白依赖查找是什么意思,翻了一大堆博客看了好多定义也不太清楚 ,后来看了小马哥视频,他通过代码演示,清楚地讲解了什么是 依赖查找以及几种依赖查找的方 ...

  6. html 5 cavans 简易祖玛

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  7. [Microsoft Teams]使用连接器接收Azure Devops的通知

    1. 什么是连接器 连接器(connector)是Teams中频道的一个接受消息的功能,官方的解释如下: 连接器允许用户订阅来自 web 服务的接收通知和消息. 它们公开服务的 HTTPS 终结点,通 ...

  8. Android开发:通过 webview 将网页打包成安卓应用

    商业转载请联系作者获得授权,非商业转载请注明出处. For commercial use, please contact the author for authorization. For non-c ...

  9. Mol Cell Proteomics. | Mapping Spatio-temporal Microproteomics Landscape in Experimental Model of Traumatic Brain Injury Unveils a link to Parkinson’s Disease

    期刊:Molecular & Cellular Proteomics 发表时间:June 16, 2019 通讯作者:Michel Salzet,Isabelle Fournier 一.  概 ...

  10. SQLServer——MASTER..spt_values

    常常见到这个表,人家用得天花乱坠的. 自己select一看却莫名其妙的. 如上, 这个表主要用来保存一些枚举值, 据说是从sybase继承过来,许多函数和存储过程可以看到它的身影.也可以叫系统常量表吧 ...