浙大PAT甲级-1006
来源:互联网 发布:携程程序员怒删数据库 编辑:程序博客网 时间:2024/06/04 18:20
比较简单
关键点:
-vector的用法(可参考http://www.cnblogs.com/wang7/archive/2012/04/27/2474138.html)
#include <iostream>#include <string>#include <vector>using namespace std;int main(){ int m, i, firstin, lastout; cin>>m; vector<string> id, in, out; i=m; while(i--){ string a,b,c; cin>>a>>b>>c; id.push_back(a); in.push_back(b); out.push_back(c); } firstin=lastout=0; for(i=1;i<m;i++){ if((in[firstin][0]>in[i][0])|| (in[firstin][0]==in[i][0]&&in[firstin][1]>in[i][1])|| (in[firstin][0]==in[i][0]&&in[firstin][1]==in[i][1]&&in[firstin][3]>in[i][3])|| (in[firstin][0]==in[i][0]&&in[firstin][1]==in[i][1]&&in[firstin][3]==in[i][3]&&in[firstin][4]>in[i][4])|| (in[firstin][0]==in[i][0]&&in[firstin][1]==in[i][1]&&in[firstin][3]==in[i][3]&&in[firstin][4]==in[i][4]&&in[firstin][6]>in[i][6])|| (in[firstin][0]==in[i][0]&&in[firstin][1]==in[i][1]&&in[firstin][3]==in[i][3]&&in[firstin][4]==in[i][4]&&in[firstin][6]==in[i][6]&&in[firstin][7]>in[i][7])) firstin=i; } for(i=1;i<m;i++){ if((out[lastout][0]<out[i][0])|| (out[lastout][0]==out[i][0]&&out[lastout][1]<out[i][1])|| (out[lastout][0]==out[i][0]&&out[lastout][1]==out[i][1]&&out[lastout][3]<out[i][3])|| (out[lastout][0]==out[i][0]&&out[lastout][1]==out[i][1]&&out[lastout][3]==out[i][3]&&out[lastout][4]<out[i][4])|| (out[lastout][0]==out[i][0]&&out[lastout][1]==out[i][1]&&out[lastout][3]==out[i][3]&&out[lastout][4]==out[i][4]&&out[lastout][6]<out[i][6])|| (out[lastout][0]==out[i][0]&&out[lastout][1]==out[i][1]&&out[lastout][3]==out[i][3]&&out[lastout][4]==out[i][4]&&out[lastout][6]==out[i][6]&&out[lastout][7]<out[i][7])) lastout=i; } cout<<id[firstin]<<" "<<id[lastout]<<endl; return 0;}
阅读全文
0 0
- 浙大PAT甲级1006
- 浙大PAT甲级-1006
- 浙大pat甲级 1023
- 浙大pat甲级 1024
- 浙大pat甲级 1025
- 浙大PAT甲级 1026
- 浙大PAT甲级 1028
- 浙大PAT甲级 1029
- 浙大PAT甲级 1030
- 浙大PAT甲级 1031
- 浙大PAT甲级 1032
- 浙大PAT甲级 1033
- 浙大PAT甲级 1035
- 浙大PAT甲级 1037
- 浙大PAT甲级 1039
- 浙大PAT甲级 1040
- 浙大PAT甲级 1038
- 浙大PAT甲级 1041
- android开发之&接口回调
- nmap参数详解
- Java后端WebSocket的Tomcat实现
- MIRO业务类型
- 单片机时钟程序(7)key.h
- 浙大PAT甲级-1006
- Android热点相关功能开发
- LeetCode 515. Find Largest Value in Each Tree Row
- Maven 本地仓库明明有jar包,但是pom文件还是报错解决办法
- 23-树的层次遍历
- IDC机房服务器
- jmeter个人学习之路--jmeter结果分析
- NXP 蓝牙QN902X 协议profile的理解
- HashMap的tableSizeFor算法理解