题目https://pintia.cn/problem-sets/994805342720868352/problems/994805411985604608

题意:

给定四个字符串。

前两个字符串中第一个相同的大写字母对应星期,第二个相同的数字或大写(A~N)表示小时。

后两个字符串中第一个相同的字母对应分钟。

这里的对应都是位置与位置一一对应。

思路:

按照题意简单模拟。要看清楚题目数据的要求。比如分钟要求的是English letter,数字相同是不算的。

 #include<cstdio>
#include<cstdlib>
#include<map>
#include<set>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue> #define inf 0x7fffffff
using namespace std;
typedef long long LL;
typedef pair<string, string> pr; string code[];
int len[];
string day[] = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"}; int main()
{
for(int i = ; i < ; i++){
cin>>code[i];
} char ch[];
int cnt = ;
for(int i = ; i < min(code[].length(), code[].length()); i++){
if(code[][i] == code[][i]){
if(cnt == && code[][i] >= 'A' && code[][i] <= 'G')
ch[cnt++] = code[][i];
else if(cnt == && (code[][i] >= 'A' && code[][i] <= 'N' || code[][i] >= '' && code[][i] <= ''))
ch[cnt++] = code[][i];
}
if(cnt == )break;
} //cout<<ch[0]<<ch[1]<<endl;
int pos;
for(int i = ; i < min(code[].length(), code[].length()); i++){
if(code[][i] == code[][i] && (code[][i] >= 'a' && code[][i] <= 'z' || code[][i] >= 'A' && code[][i] <= 'Z')){
pos = i;
break;
}
} int h;
if(ch[] >= 'A' && ch[] <= 'N'){
h = ch[] - 'A' + ;
}
else{
h = ch[] - '';
}
int d = ch[] - 'A';
cout<<day[d];
printf(" %02d:%02d\n", h, pos);
return ;
}

PAT甲级1061 Dating的更多相关文章

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

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

  2. PAT甲级——1061 Dating

    1061 Dating Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2 ...

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

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

  4. PAT甲级——A1061 Dating

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

  5. PAT 1061 Dating[简单]

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

  6. PAT甲级题解(慢慢刷中)

    博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6102219.html特别不喜欢那些随便转载别人的原创文章又不给 ...

  7. PAT甲级题分类汇编——线性

    本文为PAT甲级分类汇编系列文章. 线性类,指线性时间复杂度可以完成的题.在1051到1100中,有7道: 题号 标题 分数 大意 时间 1054 The Dominant Color 20 寻找出现 ...

  8. PAT甲级题分类汇编——序言

    今天开个坑,分类整理PAT甲级题目(https://pintia.cn/problem-sets/994805342720868352/problems/type/7)中1051~1100部分.语言是 ...

  9. PAT甲级代码仓库

    大道至简,知易行难.希望能够坚持刷题. PAT甲级真题题库,附上我的代码. Label Title Score Code Level 1001 A+B Format 20 1001 * 1002 A+ ...

随机推荐

  1. shell while内获取外部变量内容

    一.问题 问题很简单,看下面一段tmp.sh代码: #!/bin/sh x="this is the initial value of x" cat /tmp/tmp | whil ...

  2. llvm 编译

    https://llvm.org/docs/GettingStarted.html https://clang.llvm.org/get_started.html https://llvm.org/d ...

  3. MySQL5.7多主一从(多源复制)同步配置

    MySQL5.7多主一从(多源复制)同步配置(抄袭) 原文地址:https://my.oschina.net/u/2399373/blog/2878650 多主一从,也称为多源复制,数据流向: 主库1 ...

  4. PL/SQL学习笔记之条件控制语句

    一:IF-THEN语句 IF (condition) THEN commands; END IF; 二:IF-THEN_ELSE语句 IF (condition) THEN S1; ELSE S2; ...

  5. 那天有个小孩教我WCF[一][2/3]

    接着上次的继续讲吧 我们开始吧 9.创建数据库 use master go --创建库 if exists(select * from sysdatabases where name='NewsDB' ...

  6. C#:文件夹匹配

    //文件夹匹配:对比文件夹,相同的目录结构.所有文件名称小写相同,制定文件外的MD5值相同 ,则两个文件夹匹配成功! /// <summary> /// 批量匹配书籍H5资源包 /// & ...

  7. Numpy数组与PIL Image转换

    引用于这个博客

  8. egret3.x升级5.2

    第一步 先用新建项目向导新建一个5.2的项目 第二步 把3.x的代码和资源文件复制过来替换掉 修改资源加载代码 在3.x里 egret采用的是事件机制来加载资源,在5.2里则采用了await/asyn ...

  9. Java多线程系列——线程池简介

    什么是线程池? 为了避免系统频繁地创建和销毁线程,我们可以让创建的线程进行复用.用线程时从线程池中获取,用完以后不销毁线程,而是归还给线程池. JDK 对线程池的支持 为了更好的控制多线程,JDK 提 ...

  10. MT7601 AP模式移植

    MT7601 的 STA 模式和 AP 模式的驱动,是不一样的. 所以,需要另外移植驱动 驱动源码位置 https://github.com/eywalink/mt7601u 下载之后,先修改 Mak ...