1061 Dating (20分)
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分)的更多相关文章
- PAT 甲级 1061 Dating (20 分)(位置也要相同,题目看不懂)
1061 Dating (20 分) Sherlock Holmes received a note with some strange strings: Let's date! 3485djDk ...
- PAT Basic 1014 福尔摩斯的约会 (20 分) Advanced 1061 Dating (20 分)
大侦探福尔摩斯接到一张奇怪的字条:我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm.大侦探很快就明白了,字条上奇 ...
- 【PAT甲级】1061 Dating (20 分)
题意: 给出四组字符串,前两串中第一个位置相同且大小相等的大写字母(A~G)代表了周几,前两串中第二个位置相同且大小相等的大写字母或者数字(0~9,A~N)代表了几点,后两串中第一个位置相同且大小相等 ...
- PAT甲级——1061 Dating (20分)
Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkg ...
- 1061. Dating (20)
#include <stdio.h> #include <map> #include <string.h> #include <ctype.h> usi ...
- PAT (Advanced Level) 1061. Dating (20)
简单模拟. #include<stdio.h> #include<string.h> ],s2[],s3[],s4[]; ][]={"MON ", &quo ...
- PAT甲题题解-1061. Dating (20)-字符串处理,水水
#include <iostream> #include <cstdio> #include <algorithm> #include <string.h&g ...
- pat1061. Dating (20)
1061. Dating (20) 时间限制 50 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Sherlock Holmes ...
- 1061 Dating (20 分)
1061 Dating (20 分) Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh ...
随机推荐
- Design Patterns | 02 什么样的代码是好代码
目录 01 - 什么是好的代码? 02 - 评价代码的标准有哪些 2.1 可维护性(maintainability) 2.2 可读性(readability) 2.3 可扩展性(extensibili ...
- MySQL记录操作(单表查询)
单表查询的语法及关键字执行的优先级 单表查询语法 SELECT DISTINCT 字段1,字段2... FROM 表名 WHERE 条件 GROUP BY field HAVING 筛选 ORDER ...
- Vue2.0 【第二季】第2节 Vue.extend构造器的延伸
目录 Vue2.0 [第二季]第2节 Vue.extend构造器的延伸 一.什么是Vue.extend 二.自定义无参数标签 三.挂载到普通标签上 Vue2.0 [第二季]第2节 Vue.extend ...
- 安卓手机tcpdump的使用
一.常规操作步骤 1. 手机要有root权限 2. 下载tcpdump http://www.strazzere.com/android/tcpdump 3. adb push c:\wherever ...
- mimtproxy的使用(windows)
1.安装 pip3 install mitmproxy 或者下载安装指定版本:https://mitmproxy.org/downloads/ 2.配置证书 对于mitmproxy来说,如果想要截获H ...
- vue项目 github 上传项目并链接地址
git init git init: 通过命令git init把这个文件夹变成Git可管理的仓库git status git status:查看当前仓库状态 git add . 这里提示你虽然把项目粘 ...
- C/C++书籍分享(百度网盘版)
作为第一篇博客,该写一些什么好呢,毕竟作为技术博客开创的,不能随便闲谈不是. 那就分享一些书籍作为见面礼吧.链接里面包含有大量的C++学习用书籍,包含了从入门到进阶的大部分高质量书籍,注意仅用作个人学 ...
- python获取群成员信息
#coding: utf-8 import itchat,datetime from itchat.content import TEXT itchat.auto_login(hotReload=Tr ...
- orale中pl/sql的数据类型总结
一.pl/sql的概念 pl/sql简单的说就是:sql语句+编程语言的特性. 二.pl/sql的优点 1.可以提高程序的运行效率,因为能够减少数据库的访问次数. 2.可以对复杂的业务逻辑进行封装 3 ...
- 爬虫如何使用phantomjs无头浏览器解决网页源代码经过渲染的问题(以scrapy框架为例)
一.浏览器的构成 许多开发商提供了商用的浏览器来解释和显示Web文档,而所有这些浏览器几乎都使用相同的体系架构.每一种浏览器(browser)通常由三部分构成:一个控制程序,客户协议和一些解释程序.控 ...