博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【CS Round #36 (Div. 2 only) A】Bicycle Rental
阅读量:4610 次
发布时间:2019-06-09

本文共 1192 字,大约阅读时间需要 3 分钟。

【题目链接】:

【题意】

让你从n辆车中选一辆车;
每一辆车有3个属性
1.到达车的身边的时刻
2.车什么时候开始能够被使用
3.车到达它家所需时间;
问你到家的最早时刻.

【题解】

车如果晚于可用时间,a+c
否则b+c
取最小值就好
【Number Of WA
0
【反思】
手速题
【完整代码】

#include 
using namespace std;#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1#define LL long long#define rep1(i,a,b) for (int i = a;i <= b;i++)#define rep2(i,a,b) for (int i = a;i >= b;i--)#define mp make_pair#define pb push_back#define fi first#define se second#define ms(x,y) memset(x,y,sizeof x)#define Open() freopen("F:\\rush.txt","r",stdin)#define Close() ios::sync_with_stdio(0)typedef pair
pii;typedef pair
pll;const int dx[9] = {
0,1,-1,0,0,-1,-1,1,1};const int dy[9] = {
0,0,0,-1,1,-1,1,-1,1};const double pi = acos(-1.0);const int N = 1000;struct abc{ int x,y,z;};int n;abc a[N+100];int main(){ //Open(); Close(); cin >> n; rep1(i,1,n){ cin >> a[i].x >> a[i].y >> a[i].z; } int ans = 3e5+10; rep1(i,1,n){ if (a[i].x <= a[i].y){ ans = min(ans,a[i].y+a[i].z); }else{ ans = min(ans,a[i].x+a[i].z); } } cout << ans << endl; return 0;}

转载于:https://www.cnblogs.com/AWCXV/p/7626219.html

你可能感兴趣的文章
聊聊 Vue 的双向数据绑定,Model 如何改变 View,View 又是如何改变 Model 的
查看>>
背笔试!
查看>>
hdu 1561 树形DP
查看>>
python环境搭建-Pycharm模块安装方法
查看>>
Git系列二之数据管理
查看>>
XML5632 : Only one root element is allowed. Line: 1, Column 1
查看>>
反射 DataTable拓展方法 转实体对象、实体集合、JSON
查看>>
初三寒假作业
查看>>
python之路-day13-内置函数
查看>>
日志收集系统 ELK
查看>>
itunes connect
查看>>
统计输入字符串中整数的个数
查看>>
Windows系统maven安装配置
查看>>
k8s-job使用
查看>>
myeclipse codelive插件关闭
查看>>
curl操作和file_get_contents() 比较
查看>>
替换空格
查看>>
网络流24题之飞行员配对方案问题
查看>>
linux vi编辑器
查看>>
js树形结构-----(BST)二叉树增删查
查看>>