【PAT甲级】1061 Dating (20 分)
题意:
给出四组字符串,前两串中第一个位置相同且大小相等的大写字母(A~G)代表了周几,前两串中第二个位置相同且大小相等的大写字母或者数字(0~9,A~N)代表了几点,后两串中第一个位置相同且大小相等的字母所在的位置代表了几分。依照题意输出日期和时间。
AAAAAccepted code:
#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
string s1,s2,s3,s4;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>s1>>s2>>s3>>s4;
int cnt=;
int flag=;
char ans1=,ans2=;
for(int i=;i<min(s1.size(),s2.size());++i)
if(!flag&&s1[i]==s2[i]&&s1[i]>='A'&&s1[i]<='G'){
ans1=s1[i];
flag=;
}
else if(flag==&&s1[i]==s2[i]&&(s1[i]>=''&&s1[i]<=''||s1[i]>='A'&&s1[i]<='N')){
ans2=s1[i];
flag=;
}
int pos=;
for(int i=;i<min(s3.size(),s4.size());++i)
if(s3[i]==s4[i]&&(s3[i]>='A'&&s3[i]<='Z'||s3[i]>='a'&&s3[i]<='z')){
pos=i;
break;
}
if(ans1=='A')
cout<<"MON";
else if(ans1=='B')
cout<<"TUE";
else if(ans1=='C')
cout<<"WED";
else if(ans1=='D')
cout<<"THU";
else if(ans1=='E')
cout<<"FRI";
else if(ans1=='F')
cout<<"SAT";
else if(ans1=='G')
cout<<"SUN";
cout<<" ";
if(ans2>=''&&ans2<=''){
ans2-='';
cout<<;
}
else if(ans2>='A'&&ans2<='N')
ans2-='A'-;
cout<<(int)ans2<<":";
if(pos<)
cout<<;
cout<<pos;
return ;
}
【PAT甲级】1061 Dating (20 分)的更多相关文章
- PAT 甲级 1061 Dating (20 分)(位置也要相同,题目看不懂)
1061 Dating (20 分) Sherlock Holmes received a note with some strange strings: Let's date! 3485djDk ...
- PAT甲级——1061 Dating (20分)
Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkg ...
- PAT 甲级 1035 Password (20 分)(简单题)
1035 Password (20 分) To prepare for PAT, the judge sometimes has to generate random passwords for ...
- PAT 甲级 1077 Kuchiguse (20 分)(简单,找最大相同后缀)
1077 Kuchiguse (20 分) The Japanese language is notorious for its sentence ending particles. Person ...
- PAT甲级——1061 Dating
1061 Dating Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2 ...
- PAT Basic 1014 福尔摩斯的约会 (20 分) Advanced 1061 Dating (20 分)
大侦探福尔摩斯接到一张奇怪的字条:我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm.大侦探很快就明白了,字条上奇 ...
- PAT甲级——1035 Password (20分)
To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...
- 1061 Dating (20分)
Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkg ...
- PAT甲级1061 Dating
题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805411985604608 题意: 给定四个字符串. 前两个字符串 ...
随机推荐
- java项目连接Oracle配置文件
转载自:https://blog.csdn.net/shijing266/article/details/42527471 driverClassName=oracle.jdbc.driver.Ora ...
- Oracle空表的分配segment
1.查询相关参数deferred_segment_creation select * from v$parameter where name='deferred_segment_creation' ...
- 微信小程序 scroll-view 左右横向滑动没有效果(无法滑动)问题
小程序组件 scroll-view 中分别有上下竖向滑动和左右横向滑动之分,在这次项目中刚好需要用到横向滑动,但在测试过程中发现横向滑动没有了效果(静止在那里没移动过),经调试发现: 1.scroll ...
- Redis01——Redis介绍
1.NoSQL数据库概述 NoSQL(NoSQL = Not Only SQL ),意即“不仅仅是SQL”,泛指非关系型的数据库. NoSQL 不依赖业务逻辑方式存储,而以简单的key-value模式 ...
- cef源码分析之cefsimple
下面是cefsimple的入口代码,主要分成两个部分 // Entry point function for all processes. int APIENTRY wWinMain(HINSTANC ...
- 利用ansible-playbook一键部署ELK(ElasticSearch,logstash and kibana)
一.部署前环境介绍: es集群5台(es01,es02,es03,es04,es05),logstash服务器1台(logstash2),kibana服务器1台(kibana2),模拟apache服务 ...
- kali中网卡、ssh、apache的配置与开启
在Kali-linux中修改网卡文件,启动ssh和apache服务的方法 1.su root //取得root权限 2.shift+字母 //大小写字母切换 3.修改网卡 ...
- k8s默认存储动态挂载分配配置
k8s默认存储动态挂载分配配置 k8s默认存储动态挂载分配配置 https://blog.csdn.net/BigData_Mining/article/details/96973871
- 截取字符,超出的用省略号代替js实现 substring
可用到截取文字过多的问题,取0到6之间的字符,不包含6title.substring(0,6)+'...';
- Platform device/driver注册过程
Platform是一种虚拟总线,Platform机制将设备本身的资源注册进内核,有内核统一管理,在驱动程序使用这些资源时使用统一的接口,这样提高了程序的可移植性. Linux的大部分设备驱动都可以使用 ...