题目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. android中Textview 和图片同时显示时,文字省略号显示,图片自动靠到右边

    很纠结的一个标题,实在是不知道怎么去描述这个现象. 上图片吧,先看看需求是什么样的. 1.需求: ​ 视频与票的图标跟在标题后面显示,当标题过长时icon显示到省略号…后(textview省略号显示, ...

  2. 学习一个Vue模板项目

    最开始学习Vue的时候,不建议直接使用模板,而应该自己从头写起.模板都是人写的,要坚信"人能我能".只有自己亲自实践,才能促进自己主动思考,才能对模板.框架有深刻的理解. 在Git ...

  3. Android——Broadcast Receive 相关知识总结贴

    Android系统中的广播(Broadcast)机制简要介绍和学习计划 http://www.apkbus.com/android-99858-1-1.html android----BroadCas ...

  4. MySQL binlog_format (Mixed,Statement,Row)[转]

    MySQL 5.5 中对于二进制日志 (binlog) 有 3 种不同的格式可选:Mixed,Statement,Row,默认格式是 Statement.总结一下这三种格式日志的优缺点. MySQL ...

  5. 在Asp.Net中操作PDF – iTextSharp - 操作图片

    iTextSharp支持所有主流的图片格式,比如:jpg, tif, gif, bmp, png和wmf.在iTextSharp中使用Image.GetInstance()方法创建图片有很多种方式,或 ...

  6. pandas通过皮尔逊积矩线性相关系数(Pearson's r)计算数据相关性

    皮尔逊积矩线性相关系数(Pearson's r)用于计算两组数组之间是否有线性关联,举个例子: a = pd.Series([1,2,3,4,5,6,7,8,9,10]) b = pd.Series( ...

  7. Android开发(二十一)——自动更新

    参考: [1] Android应用自动更新功能的代码实现.http://www.cnblogs.com/coolszy/archive/2012/04/27/2474279.html

  8. 根据IP获取国家

    国外的还算比较权威的IP地址库,而且免费,每天调用次数不超过1000免费.超过另收费. public string Ip2Country(string ip) { try { string url = ...

  9. Vue:event对象

    一.什么是event对象 event对象:代表的是事件的状态.比如获取当前的元素:e.Target. 二.事件冒泡 什么是事件冒泡呢?百度百科的解释如下: 当事件发生后,这个事件就要开始传播(从里到外 ...

  10. Json Web Token(JWT)

    Json web token (JWT),是为了在网络应用环境间传递声明而执行的一种基于JSON的开放标准((RFC 7519).该token被设计为紧凑且安全的,特别适用于分布式站点的单点登录(Si ...