1061 Dating

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, MONfor 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<cstring>

using namespace std;

int main()
{
	char ans1[100],ans2[100],ans3[100],ans4[100];
	const char week[7][7]={"MON","TUE","WED","THU","FRI","SAT","SUN"};
	cin.get(ans1,100);
	getchar();
	cin.get(ans2,100);
	getchar();
	cin.get(ans3,100);
	getchar();
	cin.get(ans4,100);
	getchar();
//	printf("%s",ans1);
	int len1=strlen(ans1);
	int len2=strlen(ans2);
	int len3=strlen(ans3);
	int len4=strlen(ans4);
	int i;
	for(i = 0;i<len1&&i<len2;i++)
	{
		if(ans1[i]==ans2[i]&&ans1[i]>='A'&&ans1[i]<='G')
		{
			printf("%s ",week[ans1[i]-'A']);break;
		}
	}
	for(i++;i<len1&&i<len2;i++)
	{
		if(ans1[i]==ans2[i])
		{
			if(ans1[i]>='0'&&ans1[i]<='9')
			{
				printf("%02d:",ans1[i]-'0');break;
			}
			else if(ans1[i]>='A'&&ans1[i]<='N')
			{
				printf("%02d:",ans1[i]-'A'+10); break;
			}
		}
	}
	for(int j=0;j<len3&&j<len4;j++)
	{
		if(ans3[j]==ans4[j]&&((ans3[j]>='A'&&ans3[j]<='Z')||(ans3[j]>='a'&&ans3[j]<='z')) )
		{
				printf("%02d",j);break; 

		}

	}
	return 0;
 } 

PAT甲级——1061 Dating的更多相关文章

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

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

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

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

  3. PAT甲级1061 Dating

    题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805411985604608 题意: 给定四个字符串. 前两个字符串 ...

  4. PAT甲级——A1061 Dating

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

  5. PAT 1061 Dating[简单]

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

  6. PAT甲级题解(慢慢刷中)

    博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6102219.html特别不喜欢那些随便转载别人的原创文章又不给 ...

  7. PAT甲级题分类汇编——线性

    本文为PAT甲级分类汇编系列文章. 线性类,指线性时间复杂度可以完成的题.在1051到1100中,有7道: 题号 标题 分数 大意 时间 1054 The Dominant Color 20 寻找出现 ...

  8. PAT甲级题分类汇编——序言

    今天开个坑,分类整理PAT甲级题目(https://pintia.cn/problem-sets/994805342720868352/problems/type/7)中1051~1100部分.语言是 ...

  9. PAT甲级代码仓库

    大道至简,知易行难.希望能够坚持刷题. PAT甲级真题题库,附上我的代码. Label Title Score Code Level 1001 A+B Format 20 1001 * 1002 A+ ...

随机推荐

  1. sendmail 的安装、配置与发送邮件的具体实现

    Ubuntu 中sendmail 的安装.配置与发送邮件的具体实现 centos安装sendmail与使用详解 CentOS下搭建Sendmail邮件服务器 使用外部SMTP发送邮件  使用mailx ...

  2. C++ STD Gems01

    本文是根据油管大神的C++标准库课程的一个学习笔记,该课程主要介绍c++标准库中一些非常有用并且代码经常用到的工具. copy .copy_backward .copy_n .copy_if.swap ...

  3. 微信小程序返回页面传值

    一.通过url传递参数,但由于navigateTo无法跳转到导航页,所以无法往导航页传递参数 wx.navigateTo({ url: 'test?id=1' }) 二.通过wx.navigateBa ...

  4. sql注入入门--基本命令

    本文转载自http://blog.csdn.net/zgyulongfei/article/details/41017493 本文仅献给想学习渗透测试的sqlmap小白,大牛请绕过. > > ...

  5. LGOJ4299 首都

    这题是 \(LCT\) 维护子树信息中的 \(LCT\) 维护重心 Description link 题意概述:给定一个森林,要求支持以下操作 1.链接两个点 2.求一个点所在树的重心 3.求所有重心 ...

  6. PAT A1009-1012

    A 1009 Product of Polynomials (25 point(s)) 读懂题意就行. #include <cstdio> #include <iostream> ...

  7. IUBS|CODATA|Open Data in a Big Data World|National Genomics Data Center

    生命组学: National Genomics Data Center中的section: LncRNA知识库+non-code加入RNA central GWAS Atlas基因组关联分析数据库 E ...

  8. Pytorch学习--编程实战:猫和狗二分类

    Pytorch学习系列(一)至(四)均摘自<深度学习框架PyTorch入门与实践>陈云 目录: 1.程序的主要功能 2.文件组织架构 3. 关于`__init__.py` 4.数据处理 5 ...

  9. DVWA-命令执行

    开门见山 ·Low ·Medium ·High · 命令执行监听端口 ;mkfifo /tmp/pipe;sh /tmp/pipe | nc -nlp 4444 > /tmp/pipe nc 1 ...

  10. CI项目设计Redis队列

    项目开发过程中需要设计提供可平衡的处理多个用户请求的队列. 需求: 当用户登录后,查看系统中已经登录的管理员队列,然后查看后台管理员的处理能力,如果已经不能处理新的请求,则把该管理员从处理队列中删除, ...