PAT甲级1061
来源:互联网 发布:女野人耶哥蕊特 知乎 编辑:程序博客网 时间:2024/06/05 11:35
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&HyscvnmSample Output:
THU 14:04
#include<iostream>#include<string>#include<vector>using namespace std;int main(){string s1, s2, s3, s4;cin >> s1 >> s2 >> s3 >> s4;int i = 0; string ss[7] = { "MON","TUE","WED","THU","FRI","SAT","SUN" };while (s1[i] != '\0'&&s2[i] != '\0'){if (s1[i] == s2[i] && s1[i] >= 'A'&&s1[i] <= 'G'){cout << ss[s1[i] - 'A'] << " "; break;}i++;}i++;while (s1[i] != '\0'&&s2[i] != '\0'){if (s1[i] == s2[i] ){if (s1[i] >= 'A'&&s1[i] <= 'N'){cout << int(s1[i] - 'A' + 10) << ":";break;}if (s1[i] >= '0'&&s1[i] <= '9'){cout << "0" << s1[i] << ":";break;}}i++;}int j = 0; while (s3[j] != '\0'&&s4[j] != '\0'){if (s3[j] == s4[j] && (s3[j] >= 'a'&&s3[j] <= 'z' || s3[j] >= 'A'&&s3[j] <= 'Z')){if (j < 10)cout << "0" << j;elsecout << j;break;}j++;}}
- PAT(甲级)1061
- 浙大PAT甲级 1061
- PAT甲级1061
- 浙大PAT甲级-1061
- PAT 甲级
- PAT甲级 A1025.PAT RANKING
- PAT 甲级 1025 PAT Ranking
- PAT(甲级)1003
- PAT(甲级)1004
- PAT(甲级)1005
- PAT(甲级)1006
- PAT(甲级)1007
- PAT(甲级)1008
- PAT(甲级)1009
- PAT(甲级)1010
- PAT(甲级)1011
- PAT(甲级)1012
- PAT(甲级)1013
- DataGridView嵌入comboBox以及DataGridViewComboBoxColumn数据绑定
- linux c通过文件描述符以及write和read方法对文件进行读写
- C#如何调用以管理员身份运行的cmd命令提示符
- 论文笔记之Structural Deep Network Embedding
- 工具类
- PAT甲级1061
- 代码冗余到底有没有好处?
- 一招制敌 - 玩转 AngularJS 指令的 Scope (作用域)
- win10配置环境变量
- poj 3111 best(二分)
- OpenCV3.0 Examples学习笔记(7)-ffilldemo.cpp
- 解决角色移动时出现抖动的问题
- build_release/lib/libcaffe.so: undefined reference to cv::imread(cv::String const&, int)'
- 17 - 02 - 30 图解HTTP(04)