PAT甲级——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, 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<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的更多相关文章
- PAT 甲级 1061 Dating (20 分)(位置也要相同,题目看不懂)
1061 Dating (20 分) Sherlock Holmes received a note with some strange strings: Let's date! 3485djDk ...
- PAT甲级——1061 Dating (20分)
Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkg ...
- PAT甲级1061 Dating
题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805411985604608 题意: 给定四个字符串. 前两个字符串 ...
- PAT甲级——A1061 Dating
Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkg ...
- PAT 1061 Dating[简单]
1061 Dating(20 分) Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4 ...
- PAT甲级题解(慢慢刷中)
博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6102219.html特别不喜欢那些随便转载别人的原创文章又不给 ...
- PAT甲级题分类汇编——线性
本文为PAT甲级分类汇编系列文章. 线性类,指线性时间复杂度可以完成的题.在1051到1100中,有7道: 题号 标题 分数 大意 时间 1054 The Dominant Color 20 寻找出现 ...
- PAT甲级题分类汇编——序言
今天开个坑,分类整理PAT甲级题目(https://pintia.cn/problem-sets/994805342720868352/problems/type/7)中1051~1100部分.语言是 ...
- PAT甲级代码仓库
大道至简,知易行难.希望能够坚持刷题. PAT甲级真题题库,附上我的代码. Label Title Score Code Level 1001 A+B Format 20 1001 * 1002 A+ ...
随机推荐
- windows FTP上传
TCHAR tcFileName[MAX_PATH * 4] = {L"visio2010永久安装密钥.txt"}; TCHAR tcName[MAX_PATH * 4] = {0 ...
- oracle 向表中插入BLOB类型数据
提示: 待插入图片必须保存到oracle主机路径上. 步骤: 1.SYSDBA权限用户创建图片所在目录 CREATE OR REPLACE DIRECTORY TEST_DIR AS 'C:\Pict ...
- 跟踪LinkedList源码,通过分析双向链表实现原理,自定义一个双向链表
1.LinkedList实现的基本原理 LinkedList是一个双向链表,它主要有两个表示头尾节点的成员变量first .last,因其有头尾两个节点,所以从头或从尾操作数据都非常容易快捷.Lin ...
- 运营商何时会取消40G或100G流量封顶呢?短期内有望实现吗?
一直以来,运营商的不限流量套餐就饱受人们的诟病.因为说是不限流量,但其实运营商故意设置了"封顶"!最常见的封顶限制,就是流量超过40G网速会降速到1Mbps--实际下载速度为128 ...
- 和我一起从0学算法(C语言版)(四)
第三章 搜索 深度优先搜索与宽度优先搜索 定义 深度优先搜索(DFS) 过程简要来说是对每一个可能的分支路径深入到不能再深入为止,而且每个节点只能访问一次. 宽度优先搜索(BFS) 不考虑结果的可能位 ...
- opencv进行视频播放每帧处理,读取视频失败
cv::VideoCapture capture(filename); if (!capture.isOpened()) { cout << "open video error& ...
- 深度学习在美团配送ETA预估中的探索与实践
1.背景 ETA(Estimated Time of Arrival,“预计送达时间”),即用户下单后,配送人员在多长时间内将外卖送达到用户手中.送达时间预测的结果,将会以”预计送达时间”的形式,展现 ...
- ALAsset
ALAsset类代表相册中的每个资源文件,可以通过它获取资源文件的相关信息还能修改和新建资源文件,ALAssetRepresentation类代表相册中每个资源文件的详细信息,可以通过它获取资源的大小 ...
- Channels(纪念一下卡我心态的一道题)
链接:https://ac.nowcoder.com/acm/contest/3947/C来源:牛客网 题目描述 Nancy喜欢学习,也喜欢看电视. 为了想了解她能看多长时间的节目,不妨假设节目从时刻 ...
- MacOS最佳思维导图推荐-MindNode 7
思维导图软件哪个比较好呢?MindNode for mac下载一款功能简单,界面简洁,不用看教程都会用的思维导图软件.mindnode 7 mac版可随时随地记录自己的想法,让您从灵感入手,将奇思妙想 ...