problem link:
Discuss: this is problem like mango.if you are here then just use khata and pen.
don't see code
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t,i,n,l,j,k;
cin >>t;
for(k=1;k<=t;k++)
{
int plimit[11],dkind[11],sum=0,flag=0;
cin >>n>>l;
for(i=0;i<n;i++)
cin >>dkind[i];
for(i=0;i<n;i++)
cin >>plimit[i];
for(i=0;i<n;i++)
{
if(dkind[i]>plimit[i])
{
flag=1;
break;
}
else
{
sum+=dkind[i];
}
if(sum>l)
{
flag=1;
break;
}
}
printf("Case %d: ",k);
if(!flag)
cout <<"Yes"<<endl;
else
cout <<"No"<<endl;
}
return 0;
}
Discuss: this is problem like mango.if you are here then just use khata and pen.
don't see code
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t,i,n,l,j,k;
cin >>t;
for(k=1;k<=t;k++)
{
int plimit[11],dkind[11],sum=0,flag=0;
cin >>n>>l;
for(i=0;i<n;i++)
cin >>dkind[i];
for(i=0;i<n;i++)
cin >>plimit[i];
for(i=0;i<n;i++)
{
if(dkind[i]>plimit[i])
{
flag=1;
break;
}
else
{
sum+=dkind[i];
}
if(sum>l)
{
flag=1;
break;
}
}
printf("Case %d: ",k);
if(!flag)
cout <<"Yes"<<endl;
else
cout <<"No"<<endl;
}
return 0;
}
No comments:
Post a Comment