传送门
题目描述
两个人进行$轮石头剪刀布,给你每个人出圈的次数,问你第一个人最多能赢多少次,最少能赢多少次
分析
最多的应该比较好计算,取能赢的方式中,两个出圈次数的较小值相加就好了
最少次数可以用逆向思维计算,计算最多的不赢的次数,然后取补就好了
代码
#pragma GCC optimize(3)
#include <bits/stdc++.h>
#define debug(x) cout<<#x<<":"<<x<<endl;
#define dl(x) printf("%lld\n",x);
#define di(x) printf("%d\n",x);
#define _CRT_SECURE_NO_WARNINGS
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef vector<int> VI;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 10;
const ll mod = 1000000007;
const double eps = 1e-9;
const double PI = acos(-1);
template<typename T>inline void read(T &a) {
char c = getchar(); T x = 0, f = 1; while (!isdigit(c)) {if (c == '-')f = -1; c = getchar();}
while (isdigit(c)) {x = (x << 1) + (x << 3) + c - '0'; c = getchar();} a = f * x;
}
int gcd(int a, int b) {return (b > 0) ? gcd(b, a % b) : a;}
ll a[3],b[3];
int main() {
int n;
read(n);
for(int i = 0;i < 3;i++) read(a[i]);
for(int i = 0;i < 3;i++) read(b[i]);
ll res2 = min(a[0],b[1]) + min(a[1],b[2]) + min(a[2],b[0]);
ll res1 = n - min(a[0],b[2] + b[0]) - min(a[1],b[0] + b[1]) - min(a[2],b[1] + b[2]);
printf("%lld %lld\n",res1,res2);
return 0;
}
/**
* ┏┓ ┏┓+ +
* ┏┛┻━━━┛┻┓ + +
* ┃ ┃
* ┃ ━ ┃ ++ + + +
* ████━████+
* ◥██◤ ◥██◤ +
* ┃ ┻ ┃
* ┃ ┃ + +
* ┗━┓ ┏━┛
* ┃ ┃ + + + +Code is far away from
* ┃ ┃ + bug with the animal protecting
* ┃ ┗━━━┓ 神兽保佑,代码无bug
* ┃ ┣┓
* ┃ ┏┛
* ┗┓┓┏━┳┓┏┛ + + + +
* ┃┫┫ ┃┫┫
* ┗┻┛ ┗┻┛+ + + +
*/