对于这道水题本人觉得应该应用贪心算法来解这道题:
下面就贴出本人的代码吧:
#include<cstdio>
#include<iostream>
using namespace std; int a[],b[]; int main(void)
{
int n;
int need = ;
int sum1 = ,sum2 = ;
for(int i=;i<=;++i){
scanf("%d",&a[i]);
sum1 += a[i];
}
for(int i=;i<=;++i){
scanf("%d",&b[i]);
sum2 += b[i];
}
scanf("%d",&n); if(sum1%!=) need += sum1/+;
else need += sum1/; if(sum2%!=) need += sum2/+;
else need += sum2/; if(need<=n) printf("YES\n");
else printf("NO\n"); return ;
}
对于这到题本人解决之后的想法就是一定要细心,本人就是因为粗心导致连提交两次都没有A掉这题。。。。。。。令人汗颜啊