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. 【转载】ruby 中数组函数示例(1)(转)

    函数名称 说明 示例 &      数组与,返回两数组的交集 [1,2] & [2,3] =>[2]   * 复制数组n次 [1,2]*2       => [1,2,1, ...

  2. windows修改远程桌面RDP连接数

    windows 2003在默认情况下最多只允许两个用户进行远程终端连接,当达到两个远程桌面连接的到时候,再有人尝试连接,就会提示已经达到最大终端数,无法连上了. 一.windows2003终端连接数修 ...

  3. QTP使用outlook发送邮件

    '发邮件 Dim objOutlook  Dim objOutlookMsg Dim olMailItem  ' Create the Outlook object and the new mail ...

  4. Swift3.0 基础学习梳理笔记(一)

    本篇是我在学完一遍基础语法知识的时候,第一遍复习,我一遍梳理一遍记录的笔记.同时分享给像我一样在学习swift 的猿友们. 本篇可能过于冗长.所以所有的参考资料都分模块的写在palyground 里, ...

  5. vue.js解决刷新404找不到页面问题

    1.将包解压到ROOT目录后创建WEB-INF目录 mkdir WEB-INF 2.进入WEB-INF目录,创建web.xml文件 cd WEB-INF touch web.xml 3.编辑web.x ...

  6. div中嵌套的多个div使用了浮动后居中的办法

    今天做网页的时候遇到了标题中的问题,网上查到了解决办法,记录一下一放以后忘记 <div class="wai"> <div style="float:l ...

  7. Unusual Sequences

    题意: 求解合为 y 的总体 gcd 为 x 的正整数非空序列个数. 解法: 特判一下后,原问题等价于合为 s = y/x 的整体gcd为1的正整数序列个数. 1.$ans = \sum_{\sum{ ...

  8. RecommenderFilterSalaryResult

    package org.andy.mymahout.recommendation.job; import java.io.BufferedReader; import java.io.File; im ...

  9. NULL 与 ""

    char *str1 = NULL; //str1为空 char *str2 = ""; //str2为一个空字符串 NULL没有分配空间,""分配了空间.

  10. jquery 简单入门

    例:GridView