牛客 做游戏(贪心)

题目链接:点击这里

在这里插入图片描述
在这里插入图片描述
尽可能让牛牛的每次出 剪刀/石头/布 对应到 牛可乐出 布/剪刀/石头。

时间复杂度 O ( 1 ) O(1)

#include<iostream>
#include<algorithm>
#include<string>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;
typedef long long ll;
const int MOD = 10000007;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int maxn = 1010;
int a[maxn], b[maxn];

int main()
{
	int a, b, c, x, y, z;
	scanf("%d%d%d", &a, &b, &c);
	scanf("%d%d%d", &x, &y, &z);
	
	ll ans = 0;
	ans += min(c, x);
	ans += min(b, z);
	ans += min(a, y);
	
	printf("%lld\n", ans);
	return 0;
}
发布了727 篇原创文章 · 获赞 111 · 访问量 12万+

猜你喜欢

转载自blog.csdn.net/qq_42815188/article/details/104201507
今日推荐