1061. Dating (20)

时间限制
50 ms
内存限制
65536 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<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)的更多相关文章

  1. PAT1061:Dating

    1061. Dating (20) 时间限制 150 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Sherlock Holme ...

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

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

  3. PAT Basic 1014 福尔摩斯的约会 (20 分) Advanced 1061 Dating (20 分)

    大侦探福尔摩斯接到一张奇怪的字条:我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm.大侦探很快就明白了,字条上奇 ...

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

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

  5. 1061 Dating (20分)

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

  6. 1061. Dating (20)

    #include <stdio.h> #include <map> #include <string.h> #include <ctype.h> usi ...

  7. PAT (Advanced Level) 1061. Dating (20)

    简单模拟. #include<stdio.h> #include<string.h> ],s2[],s3[],s4[]; ][]={"MON ", &quo ...

  8. PAT甲题题解-1061. Dating (20)-字符串处理,水水

    #include <iostream> #include <cstdio> #include <algorithm> #include <string.h&g ...

  9. 【PAT甲级】1061 Dating (20 分)

    题意: 给出四组字符串,前两串中第一个位置相同且大小相等的大写字母(A~G)代表了周几,前两串中第二个位置相同且大小相等的大写字母或者数字(0~9,A~N)代表了几点,后两串中第一个位置相同且大小相等 ...

随机推荐

  1. 关于使用C# 启动msi失败的问题

    原以为在启动msi是件小儿科的事,上代码: ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = "C:\\myTest ...

  2. NameNode内存优化---基于缓存相同文件名的方法

    NameNode内存优化---重用相同的文件名      原创文章,转载请注明:博客园aprogramer 原文链接:NameNode内存优化---重用相同的文件名      众所周知,Hadoop集 ...

  3. WPF实现右键菜单

    ContextMenu类就是用来做右键菜单的对象,对于任何的控件都可以进行对ContextMenu属性的操作进行设置右键菜单的功能. 下面代码就是对一个按钮添加一个WPF右键菜单的功能: < B ...

  4. 问题:C# List;结果:C#中数组、ArrayList和List三者的区别

    C#中数组.ArrayList和List三者的区别 分类: [C#那些事] 2013-03-11 00:03 36533人阅读 评论(23) 收藏 举报 目录(?)[+] 在C#中数组,ArrayLi ...

  5. Zabbix_proxy的架设

    一.安装zabbix-proxy与导入数据库 1. 安装 zabbix-server $ sudo rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/ ...

  6. IE和W3c盒模型

    盒子模型是css中一个重要的概念,理解了盒子模型才能更好的排版.其实盒子模型有两种,分别是 ie 盒子模型和标准 w3c 盒子模型.他们对盒子模型的解释各不相同,先来看看我们熟知的标准盒子模型: 从上 ...

  7. c/c++进制转换练习

    1 下列数最大的是( ).括号内为数字,括号外为进制.(360集团) (10010101)2 (227)8------>10010111 (96)16------>10010110 (14 ...

  8. web 系统原理之路由器和交换机的区别

    工作层次不同: 交换机主要工作在数据链路层(第二层) 路由器工作在网络层(第三层). 转发依据不同: 交换机转发所依据的对象时:MAC地址.(物理地址) 路由转发所依据的对象是:IP地址.(网络地址) ...

  9. java之格式化输出

    参考http://how2j.cn/k/number-string/number-string-foramt/320.html#nowhere 格式化输出 如果不使用格式化输出,就需要进行字符串连接, ...

  10. 第一章 –– Java基础语法

    第一章 –– Java基础语法 span::selection, .CodeMirror-line > span > span::selection { background: #d7d4 ...