题解
2024-12-09 21:20:40
发布于:广东
9阅读
0回复
0点赞
贪心,也没说吃几个,那就全吃了(
吃掉一盘菜就把所需的对应元素逐个减少,如果最后都小于 就说明已经足够了.
#include <iostream>
#include <cstdio>
#define int long long
using namespace std;
int a[100005];
signed main(){
cin.tie(nullptr) -> sync_with_stdio(0);
cout.tie(nullptr) -> sync_with_stdio(0);
int n, m;
cin >> m >> n;
for(int i = 1; i <= n; i++) cin >> a[i];
int x;
for(int i = 1; i <= m; i++){
for(int j = 1; j <= n; j++) cin >> x, a[j] -= x;//减去营养
}
for(int i = 1; i <= n; i++){
if(a[i] > 0){
cout << "No";//还有元素没摄取完毕
return 0;
}
}
cout << "Yes";
return 0;
}
这里空空如也
有帮助,赞一个