Rock, Paper, Scissors

链接 : http://codeforces.com/problemset/problem/1426/E

代码
#include <bits/stdc++.h>
using namespace std;
#define IO ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
inline int lowbit(int x) { return x & (-x); }
#define ll long long
#define pb push_back
#define PII pair<int, int>
#define fi first
#define se second
#define inf 0x3f3f3f3f
const int N = 1e5 + 7;
int a[5], b[5];

int main() {	
    IO;
    int n, ans1 = inf, ans2 = 0, t;
    cin >> n;
    for (int i = 1; i <= 3; ++i) cin >> a[i];
    for (int i = 1; i <= 3; ++i) cin >> b[i];
    for (int i = 1; i <= 3; ++i) {
        int j = (i % 3) + 1;
        t = min(a[i], b[j]);
        ans2 += t;
    }
    
    for(int i = 1; i <= 3; ++i) {
        int j = (i % 3) + 1;
        if (b[i] >= a[i] + a[j]) ans1 = min(ans1, b[i] - a[i] - a[j]);
    }
    if (ans1 == inf) ans1 = 0;   
    cout << ans1 << " " << ans2 << endl;
    return 0;
}

posted @ 2020-11-19 21:08  phr2000  阅读(91)  评论(0编辑  收藏  举报