PAT甲级1061 Dating
题目: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的更多相关文章
- PAT 甲级 1061 Dating (20 分)(位置也要相同,题目看不懂)
1061 Dating (20 分) Sherlock Holmes received a note with some strange strings: Let's date! 3485djDk ...
- PAT甲级——1061 Dating
1061 Dating Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2 ...
- PAT甲级——1061 Dating (20分)
Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkg ...
- PAT甲级——A1061 Dating
Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkg ...
- PAT 1061 Dating[简单]
1061 Dating(20 分) Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4 ...
- PAT甲级题解(慢慢刷中)
博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6102219.html特别不喜欢那些随便转载别人的原创文章又不给 ...
- PAT甲级题分类汇编——线性
本文为PAT甲级分类汇编系列文章. 线性类,指线性时间复杂度可以完成的题.在1051到1100中,有7道: 题号 标题 分数 大意 时间 1054 The Dominant Color 20 寻找出现 ...
- PAT甲级题分类汇编——序言
今天开个坑,分类整理PAT甲级题目(https://pintia.cn/problem-sets/994805342720868352/problems/type/7)中1051~1100部分.语言是 ...
- PAT甲级代码仓库
大道至简,知易行难.希望能够坚持刷题. PAT甲级真题题库,附上我的代码. Label Title Score Code Level 1001 A+B Format 20 1001 * 1002 A+ ...
随机推荐
- 修改oracle为归档模式
1.查看是否为归档模式 SQL> archive log list; Database log mode No Archive Mode Automatic archival Disabled ...
- Seaslog安装和参数配置
详细文档访问:https://github.com/Neeke/SeasLog/blob/master/README_zh.md 源码安装步骤: 1.先下载Seaslog源码,下载地址:http:// ...
- 9.1 翻译系列:数据注解特性之----Table【EF 6 Code-First 系列】
原文地址:http://www.entityframeworktutorial.net/code-first/table-dataannotations-attribute-in-code-first ...
- Hexo NexT 博客本地搭建指南
0x01 写在前面的话 第一次见到这个这个Hexo主题,是在查找lucene学习指南时看到了阿里中间件博客,文章写的自然不错,但博客程序主题更是令我喜欢不已. 于是我便萌生了也想撸一个的冲动. 既然想 ...
- 关于uframe源码的一些解读
游戏管理. GameManager单例:绑定在不同的gameobject上,还是会每次都实例化一个GameManager但是可以为每一个GameManager赋值一个已经存在的单例---------- ...
- Asp.Net WebApi swagger使用教程
swagger简介 别名:丝袜哥 功能:用于生产api文档 swagger安装 Nuget搜索swagger,然后安装Swashbuckle swagger使用 生成api的xml文档 webapi项 ...
- Linux下ip地址查询
[时间:2016-12] [状态:Open] [关键词:linux,ip地址,ifconfig,ip addr] 0 引用 说起来比较搞笑,我在windows下知道可以使用ipconfig命令查询本机 ...
- 【WPF】自定义形状的按钮Button
需求:做一个如下图所示的多边形按钮. <!-- 特殊形状的按钮 --> <Grid> <Polygon Points="0,0 140,0 190,42 140 ...
- Odoo小数精度及货币精度详解
一.小数精度的设置 一般在设置-数据结构-精度设置中就可以对 小数类型的字段进行精度设置: 对于代码中定义为 digits=dp.get_precision('Product Price') 或 di ...
- 系统垃圾清理利器CCleaner v5.30.6063绿色单文件版(增强版)
系统垃圾清理利器CCleaner现已更新至v5.30.6063,此次更新为Edge.IE浏览器提供了更好的清理功能,更新了Windows Explorer MRU清理功能,同时改善了应用程序中的SSD ...