比赛的时候太过紧张,导致全程都在看一些相对难的题目。最后比赛结束回过头发现了这道题,原来这么简单,就将代码写一写
#include<iostream>
using namespace std;
int main()
{
bool flag=false;
int N,b,T,count = 0;
int num_1[10000],num_2[10000];
cin>>T;
while(T--)
{
count=0;
cin>>N>>b;
for(int i = 0; i<N; i++)
cin>>num_1[i];
for(int j = 0; j<N-1; j++)
cin>>num_2[j];
for(int i = 0; i<N-1; i++)
{
count += num_1[i];
if(count < num_2[i]*b)
{
flag=true;
break;
}
count=count-num_2[i]*b;
}
if(flag)
cout<<"No"<<endl;
else
cout<<"Yes"<<endl;
}
return 0;
}