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)代表了几点,后两串中第一个位置相同且大小相等 ...
随机推荐
- ES6学习之Proxy
定义:“代理器”,用于修改某些操作的默认行为,等同于在语言层面做出修改,所以属于一种“元编程”(meta programming),即对编程语言进行编程.可以对外界的访问进行过滤和改写. 语法: va ...
- python oop培训文档里面的 正宗oop、多个函数间反复return传参、多个文件无限复制粘贴扣字、无效废物滑稽类4种方式的例子。(2)
把文档里面说的几种范式发出来. 4种编程范式实现一个人吃喝拉撒长身体的代码.语法很简单,思想模拟了所有程序员写代码时候的代码规划设计想法. 0.我不反对复制粘贴的写法,可以百度搜索复制粘贴网上现有的, ...
- mysql错误代号大全
B.1. 服务器错误代码和消息 服务器错误信息来自下述源文件: · 错误消息信息列在share/errmsg.txt文件中."%d"和"%s"分别代表编号和字符 ...
- 伪分布模式 hive查询
[root@node1 ~]# lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian ...
- 代码 c++实现动态栈
//============================================================================ // Name : 栈.cpp // Au ...
- SM4算法的c++实现
百度到的论文已给出算法. flag为1为解密,flag为0是加密. #include<bits/stdc++.h> using namespace std; typedef long lo ...
- This account is currently not available
今天在linux下切换用户发现提示This account is currently not available,说是无效用户了后来网上查了一下发现是用户的shell禁止登录了,解决方法只要开启she ...
- shell工具使用配置备忘
一.bash之vi mode.两种方式:set -o vi(只让bash自己进入vi模式)或 set editing-mode vi(让所有使用readline库函数的程序在读取命令行时都进入vi模式 ...
- 21 、GPD-PSL-VCF
https://genome.ucsc.edu/FAQ/FAQformat.html#format9 1.Variant Call Format(VCF) Example ##fileformat=V ...
- java8 创建树结构的数据
private List<TreeNode> createTree(Integer pid, Map<Integer, List<SysPermission>> m ...