1061. Dating (20)

时间限制
50 ms
内存限制
32000 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue

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"
#include "algorithm"
#include "string"
#include <string.h>
#include<stdlib.h>
#include<stdio.h>
#include "vector"
using namespace std;
#define N 81

int main()
{
char w[7][4]={{"MON"},{"TUE"},{"WED"},{"THU"},{"FRI"},{"SAT"},{"SUN"}};
char s1[N],s2[N],s3[N],s4[N];
cin >> s1 >> s2 >> s3 >>s4;
int week,hour,mintute;
int i=0;
while(i<strlen(s1)&&i<strlen(s2))
{
if(s1[i]==s2[i]&&s1[i]>='A'&&s1[i]<='G')
{
week = s1[i]- 'A';
break;
}
i++;
}
i++;
while(i<strlen(s1)&&i<strlen(s2))
{
if(((s1[i]>='A'&&s1[i]<='N')||(s1[i]>='0'&&s1[i]<='9'))&&s1[i]==s2[i])
{

if(s1[i]>='A'&&s1[i]<='N')
{
hour = s1[i]-'A'+10;
break;
}
else if(s1[i]>='0'&&s1[i]<='9')
{
hour = s1[i]-'0';
break;
}
}
i++;

}
i=0;
while(i<strlen(s3)&&i<strlen(s4))
{
if(s3[i]==s4[i]&&((s3[i]>='A'&&s3[i]<='Z')||(s3[i]>='a'&&s3[i]<='z')))
{
mintute = i;
break;
}
i++;
}
printf("%s %02d:%02d\n",w[week],hour,mintute);

return 0;
}


浙大pat 1062题解的更多相关文章

  1. 浙大pat 1035题解

    1035. Password (20) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To prepare f ...

  2. 浙大pat 1025题解

    1025. PAT Ranking (25) 时间限制 200 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Programmi ...

  3. 浙大pat 1011题解

    With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...

  4. 浙大PAT 7-06 题解

    #include <stdio.h> #include <iostream> #include <algorithm> #include <math.h> ...

  5. 浙大pat 1012题解

    1012. The Best Rank (25) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To eval ...

  6. 浙大 pat 1003 题解

    1003. Emergency (25) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue As an emerg ...

  7. 浙大 pat 1038 题解

    1038. Recover the Smallest Number (30) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHE ...

  8. 浙大 pat 1047题解

    1047. Student List for Course (25) 时间限制 400 ms 内存限制 64000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Y ...

  9. 浙大pat 1054 题解

    1054. The Dominant Color (20) 时间限制 100 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard Behind the scen ...

随机推荐

  1. GTK+2.0学习——code::block使用

    在之后使用中会慢慢去完善~~ 一.编码设置 1.设置文件编码:setting->editor->如图 2.设置编译时的编码(记住二者要统一):setting->compiler-&g ...

  2. 【安装】python3.4版安装与2.x共存问题

    首先,到官网去下载python3.x版,这里推荐3.4以上的版本,自带pip库,以后不用自己另外下载 3.4.4版: https://www.python.org/downloads/release/ ...

  3. Objective-C Runtime 运行时之三:方法与消息(转载)

    前面我们讨论了Runtime中对类和对象的处理,及对成员变量与属性的处理.这一章,我们就要开始讨论Runtime中最有意思的一部分:消息处理机制.我们将详细讨论消息的发送及消息的转发.不过在讨论消息之 ...

  4. ECS活动真实IP (前端存在SLB)

    log_format main 'realip:$http_x_forwarded_for slbip:$remote_addr-$remote_user [$time_local] "$r ...

  5. canvas画扇形图(本文来自于http://jo2.org/html5-canvas-sector/)

    1.定义画扇形的构造函数: //扇形CanvasRenderingContext2D.prototype.sector = function (x, y, radius, sDeg, eDeg) {/ ...

  6. js数组操作-数组去重

    第一个和第二个,都是对新数组或新json进行操作,而第三个是对原数组本身进行indexOf.第一个是用新数组的indexOf来判断是否有重复元素,而第二个是通过nHash[item]来判断是否存在. ...

  7. 技能学习经验与C语言学习调查

    技能学习经验与C语言学习调查 前言 要说的话,这还是我第一次写博客.不论是为了作业也好,为了将来的学习工作也好,写博客都是必不可少的,也算是个自我提升的途径吧.不过第一次写博客,就用从来没听说过的ma ...

  8. 5.Struts2的OGNL表达式

    1.创建javaweb项目Struts2_Part4_OGNL并在WebRoot下的WEB-INF下的lib文件夹下添加如下jar文件 commons.jar commons.jar freemark ...

  9. Gulp安装使用教程

    题记:为什么要使用gulp,网上有很多关于gulp的优势,而在我看来,这些都是工具的优势!工具的优势最主要体现在易用性上,听说gulp比grunt更易用,所以这里写个文档记录. 同样要保证nodejs ...

  10. centos6.5 安装ansible,管理多台服务器

    安装python(最低2.6v) (1).python2.7安装 wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz # tar ...