先判断蓝莓和草莓数量是否够完成至少一个。
但蓝莓和草莓会有多余或不够用的情况,那么我们只需要取 和 中的最小值即可。
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);
}
暂无评论