logo AlgoBeat OnlineJudge
登录 注册

「[语言月赛 202512] 小蓝莓和小草莓」题解

作者: Dr_KC_Haus  ·  发布于 2026-07-08 19:35:14  ·  最后修改于 2026-07-08 20:17:36
已通过
审核员:joe_zxq 彩笔 · 2026-07-08 20:17:36

先判断蓝莓和草莓数量是否够完成至少一个。

但蓝莓和草莓会有多余或不够用的情况,那么我们只需要取 中的最小值即可。

AC Code

#include<bits/stdc++.h>
#define int long long
using namespace  std;
using LL = unsigned long long;
constexpr int N=1e7+7;
signed main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int n,m;
	cin>>n>>m;
	if(n>=3&&m>=2){
		cout<<min(n/3,m/2);
	}	
	else cout<<0;
	exit(0);
}

暂无评论

登录 后即可评论。