zoukankan      html  css  js  c++  java
  • 【CS Round #36 (Div. 2 only) A】Bicycle Rental

    【题目链接】:https://csacademy.com/contest/round-36/task/bicycle-rental/

    【题意】

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

    【题解】

    车如果晚于可用时间,a+c
    否则b+c
    取最小值就好

    【Number Of WA

    0

    【反思】

    手速题

    【完整代码】

    #include <bits/stdc++.h>
    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<int,int> pii;
    typedef pair<LL,LL> 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;
    }
    
  • 相关阅读:
    死锁
    不能复制文件到服务器
    JWT
    身份验证
    依赖注入
    ml.net
    swift 枚举、结构、类
    nginx 负载均衡
    sql 时间函数大全
    更新SVN时提示要清理,但清理失败,乱码得解决方案
  • 原文地址:https://www.cnblogs.com/AWCXV/p/7626219.html
Copyright © 2011-2022 走看看