pat1061. Dating (20)
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
劣题。题意不清,并没有说明两字符串字符对应相等的含义竟然是字符大小和字符在本身字符串的位置也要相等,故为上等劣题,纯粹为了做题而做题!
以下是我认为对的代码:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream>
using namespace std; const int N=;
char w[][]={{"MON"},{"TUE"},{"WED"},{"THU"},{"FRI"},{"SAT"},{"SUN"}};
int main()
{
char s1[N],s2[N],s3[N],s4[N];
scanf("%s%s%s%s",s1,s2,s3,s4);
int i=;
int week,hh,mm;
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]==s2[i]&& ((s1[i]>='A'&&s1[i]<='N')||(s1[i]>=''&&s1[i]<=''))){
if((s1[i]>='A'&&s1[i]<='N'))
hh=s1[i]-'A'+;
else if(s1[i]>=''&&s1[i]<='')
hh=s1[i]-'';
break;
}
i++;
}
i=;
while(i<strlen(s3)&&i<strlen(s4)){
if(s3[i]==s4[i]&&((s3[i]>='A'&&s3[i]<='Z')||(s3[i]>='a'&&s3[i]<='z'))){
mm=i;
break;
}
i++;
}
printf("%s %02d:%02d\n",w[week],hh,mm);
return ;
}
pat1061. Dating (20)的更多相关文章
- PAT1061:Dating
1061. Dating (20) 时间限制 150 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Sherlock Holme ...
- 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分)
Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkg ...
- 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 ...
- 【PAT甲级】1061 Dating (20 分)
题意: 给出四组字符串,前两串中第一个位置相同且大小相等的大写字母(A~G)代表了周几,前两串中第二个位置相同且大小相等的大写字母或者数字(0~9,A~N)代表了几点,后两串中第一个位置相同且大小相等 ...
随机推荐
- js之递归拼树(树结构的数据结构)
- 【253】◀▶IEW-Unit18
Unit 18 International Events 1.model1对应题目分析 The Olympic Games is a major international sporting even ...
- groupadd添加新组
一.groupadd命令用于将新组加入系统. 格式groupadd [-g gid] [-o]] [-r] [-f] groupname 主要参数 -g gid:指定组ID号. -o:允许组ID号,不 ...
- 微观SOA:服务设计原则及其实践方式
大 量互联网公司都在拥抱SOA和服务化,但业界对SOA的很多讨论都比较偏向高大上.本文试图从稍微不同的角度,以相对接地气的方式来讨论SOA, 集中讨论SOA在微观实践层面中的缘起.本质和具体操作方式, ...
- 超级台阶 (NYOJ—76)
很简单的高中数学题,写出来主要是提醒自己,写完递推公式(尤其是公式)一定要检查多遍. #include<stdio.h> #include<string.h> int M; i ...
- 【mybatis 如何写union和union查询】
select d.* from (select a.CheckType,b.UserName,a.CheckNumber, a.PayName ,a.PayBank,a.PayBankNumber,a ...
- Web调试利器fiddler介绍
转载:http://blog.chinaunix.net/uid-27105712-id-3738821.html 最近在使用fiddler,发现这个真是非常最犀利的web调试工具,笔者这里强烈推荐给 ...
- Android APK反编译技巧全讲解
导言:在我们安卓开发当中,我们不仅需要掌握基础的开发技能,也需要掌握软件的安全技能,这样才可以让我们的软件能够成为一款能够真正可以进行发布的软件,同时也可以让自己的核心技术不会被别人所盗取. 首先我们 ...
- (PHP)redis Set(集合)操作
/** * * Set操作 * 集合命令 * 保证数据的唯一 * 不保证顺序 * */ //将一个元素加入集合,已经存在集合中的元素则忽略.若集合不存在则先创建,若key不是集合类型则返回false, ...
- 为什么MOBA和吃鸡类游戏不推荐用tcp协议 延迟不利于实时游戏
http://news.gamedog.cn/a/20171221/2287418.html 我们知道,不同类型的游戏因为玩法.竞技程度不一样,采用的同步算法不一样,对网络延迟的要求也不一样.例如,M ...