题目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. Swift -- 中文版两大官方文档汇总

    Swift官方文档由CocoaChina翻译小组精心翻译制作而成,目前两本文档中文版已全部完成!在此,我们对所有参与的译者.组织人员以及工作人员表示衷心的感谢!本文为您提供两本文档的在线阅读以及下载! ...

  2. CentOS下网卡启动、配置等ifcfg-eth0教程(转)

    步骤1.配置/etc/sysconfig/network-scripts/ifcfg-eth0 里的文件.it动力的CentOS下的ifcfg-eth0的配置详情: [root@localhost ~ ...

  3. 【SqlServer】解析SqlServer的分页

    方式1: 假设页数是10,现在要拿出第5页的内容,查询语句如下: --10代表分页的大小 * from test where id not in ( --40是这么计算出来的:10*(5-1) id ...

  4. Socket网络编程--epoll小结

    以前使用的用于I/O多路复用为了方便就使用select函数,但select这个函数是有缺陷的.因为它所支持的并发连接数是有限的(一般小于1024),因为用户处理的数组是使用硬编码的.这个最大值为FD_ ...

  5. Android查询不到电话号码解决方法

    貌似联系人有三个数据库,且不同步,另外也有可能是版本问题. 解决方案:https://github.com/codinguser/android_contact_picker 接下来会对其进行一些改造 ...

  6. Google file system

    读完了Google file system论文的中文版,记录一下总结,懒得打字,直接上草图:

  7. elk问题,求教各位大虾!

    [filebeat --> kafka --> logstash-->MongoDB|磁盘]架构进行日志收集 但是当logstash写入MongoDB有延迟,然后正常之后,会导致lo ...

  8. Java知多少(83)面板基础:JPanel和JScrollPane

    面板有两种,一种是普通面板(JPanel),另一种是滚动面板(JScrollPane). JPanel 面板是一种通用容器,JPanel的作用是实现界面的层次结构,在它上面放入一些组件,也可以在上面绘 ...

  9. 二、主流区块链技术特点及Hyperledger Fabric V0.6版本特点

    一.主流区块链技术特点 二.HyperLedger子项目 三.Hyperledger fabric架构 V0.6逻辑架构: V0.6区块链网络 对应的0.6版本的运行时架构: 0.6版本的架构特点是: ...

  10. 【转帖】oracle数据类型和对应的java类型

    原文地址:http://otndnld.oracle.co.jp/document/products/oracle10g/102/doc_cd/java.102/B19275-03/datacc.ht ...