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. 2018年高教社杯全国大学生数学建模竞赛A题解题思路

    题目 先贴一下A的题目吧 A题   高温作业专用服装设计 在高温环境下工作时,人们需要穿着专用服装以避免灼伤.专用服装通常由三层织物材料构成,记为I.II.III层,其中I层与外界环境接触,III层与 ...

  2. 破解Zip加密文件常用的几种方法

    前言 在互联网的浪潮中,大家也许碰到过这种情况: 从网络上下载了一个zip文件,最后却发现它是用密码保护的,或者自己用密码加密了一个很重要zip文件,但是一段时间后忘记了密码,无法打开.这个时候,我们 ...

  3. linux下core file size设置笔记

    现象说明:突然发现一台测试机器的java程序莫名其妙地没了,但是没有core dump!这就需要打开服务器的core文件生成的功能了,(即core dump文件),方便程序调试.1)core文件简介c ...

  4. <软件体系结构>实验框架选择及其说明

    一.框架选择 本次实验,我所采取的框架是SSH框架.那么首先,我想简单的说明一下SSH框架,一方面给自己复习一下知识,另一方面也能使自己在以后看这篇博客的时候不至于太费力. SSH不是一个框架,而是S ...

  5. github学习心得

    1.在GitHub上建立项目登录GitHub后,你可以在右边靠中那里找到一个按钮“New Repository”,点击过后,填入项目名称.说明和网址过后就可以创建.2.配置Git以及上传代码安装Git ...

  6. java可变参数长度

    一: 在python中 有可变参数*args和万能参数**args参数分别为列表和字典.在java中也有类似的可变参数列表.不过传递进去的是可变参数数组. package com.company; p ...

  7. MSA微服务

    https://github.com/das2017?tab=repositories https://github.com/icsharpcode/ILSpy/releases LayerDemo ...

  8. opencv学习笔记(二)

    摘要:学习资料主要参考于毛星云主编<opencv3编程入门> 1.图像显示 #include<opencv2/opencv.hpp> using namespace cv; / ...

  9. 数字证书签发,授权等相关以及https建立通信过程

    一直以来都对数字证书的签发,以及信任等事情一知半解.总算有个闲适的周末来总结和深入一下相关的知识. CA: CA(Certificate Authority)是证书的签发机构,它是负责管理和签发证书的 ...

  10. 如何使用git在github上开发的时候和别人在别人仓库上进行协作编程,最后再统一提交

    因为总是忘记,所以记录一下. 这里首先需要添加你需要操作对象的仓库到你的远程仓库并给个名字,才能进行操作.这里我用我同事的邮箱做比喻.(如果对方为私有仓库,你必须要有同样的权限) 使用命令 git r ...