PAT甲级1006水题飘过
题目分析:由于不存在相同的两个时间(24:00:00和00:00:00不会同时存在),则我们假设两个全局变量存放到达的最早的时间和达到的最晚的时间,设置最早的初值为“23:59:59”,设置最晚的初值为“00:00:00”,只要一个人到达的时间比最早的早则更新最早时间同时将id记录下来,最晚的情况也是同样的
#include<iostream>
#include<string>
using namespace std; int main(){
int n;
while(scanf("%d", &n) != EOF){
string name1 = "xxx";
string name2 = "xxx";
string time_in = "23:59:59";
string time_out = "00:00:00";
string id, in, out;
for(int i = ; i <= n; i++){
cin>>id>>in>>out;
if(in <= time_in){
time_in = in;
name1 = id;
}
if(out >= time_out){
time_out = out;
name2 = id;
}
}
cout<<name1<<" "<<name2<<endl;
}
return ;
}
PAT甲级1006水题飘过的更多相关文章
- PAT甲级1019水题飘过
题目分析: 将n转成对应大小的b进制数之后判断是否为回文串,是则Yes,否则No #include<iostream> using namespace std; ]; //存放从0开始b进 ...
- PAT甲级1009水题飘过
题目分析:简单的多项式的模拟乘法,你可以假设未知数为x,exp为x的指数,coe为x的系数,则很容易就把答案推算出来,注意答案是从指数的高往低输出,同时要注意的是这是多项式的乘法,虽然指数的范围只有0 ...
- PAT甲级1011水题飘过
题目分析:对于输入的数据分三条,选出每条中最大值记录下来,按照题目要求算出最大可能的获利即可 #include<iostream> using namespace std; ]; //k数 ...
- PAT甲级1008水题飘过
题目分析:上去下来到达的时间和数量 #include<iostream> using namespace std; ]; int main(){ int n; while(scanf(&q ...
- PAT甲级1005水题飘过
题目分析:用一个字符串输入之后遍历每一位求和后,不断%10获取最后一位存储下来,逆序用对应的英文单词输出(注意输入为0的情况) #include<iostream> #include< ...
- PAT甲级1002水题飘过
#include<iostream> #include<string.h> using namespace std; ]; int main(){ int n1, n2; wh ...
- PAT甲级1001水题飘过
#include<iostream> using namespace std; int main(){ int a, b; while(scanf("%d%d", &a ...
- PAT甲级训练刷题代码记录
刷题链接:https://www.patest.cn/contests/pat-a-practise 1001 #include <iostream> #include <stdio ...
- PAT甲级 Dijkstra 相关题_C++题解
Dijkstra PAT (Advanced Level) Practice Dijkstra 相关题 目录 <算法笔记>重点摘要 1003 Emergency (25) <算法笔记 ...
随机推荐
- Python -- 正则表达式 regular expression
正则表达式(regular expression) 根据其英文翻译,re模块 作用:用来匹配字符串. 在Python中,正则表达式是特殊的字符序列,检查一个字符串是否与某种模式匹配. 设计思想:用一 ...
- swap file "*.swp" already exists!的解决方法
Linux下编程难免要开启多个vim共同编辑同一个文件,这时再次保存就会出现: swap file "*.swp" already exists! [O]pen Read-Only ...
- UE4的多线程
1. 源代码 AsyncWork.h 2. 多线程的使用 参考文档:https://wiki.unrealengine.com/Using_AsyncTasks 当我们需要执行一个需要很长时间的任务时 ...
- BERT模型
BERT模型是什么 BERT的全称是Bidirectional Encoder Representation from Transformers,即双向Transformer的Encoder,因为de ...
- Mybatis的if标签判断空字符串 == 0,参数为0时会自动转为空字符串
对于这个问题,有两种解决办法. 1.当传入的参数有0时,只判断!=null即可. 2.将0转化为String类型,就可以解决这个问题.
- asp.netCore3.0 中使用app.UseMvc() 配置路由
一.新配置路由策略 在 Asp.Net Core 3.0中默认不再支持app.UserMvc() 方式配置路由 系统. 而是使用新的模式,点击查看asp.netCore3.0区域和路由配置变化 默认 ...
- git rebase 多分支操作
- git rebase and git merge 区别 这一次彻底搞懂 Git Rebase - git在工作中正确的使用方式----git rebase篇 Git 操作假设Git目前只有一个分支 ...
- uniapp - 文字收缩展示插件
插件地址:https://ext.dcloud.net.cn/plugin?id=657
- 织梦Dedecms后台登陆密码忘记怎么办?
有时候长期不登陆后台或则初次建站的新手常常忘记后台登陆密码,不过不用着急,早就有人写好了密码重设工具. 下载解压为radminpass.php, 通过FTP传到网站根目录,然后访问 http:// ...
- 虚拟环境上的jupyterhub开机启动设置
为了让jupyterhub 开机启动,或者以服务的方式启动,折腾了好久.环境 ubuntu 16.04anaconda >= 4.5python35 jupyterhub 0.9.4node 6 ...