SAVWATER- Editorial

Setter: Daanish Mahajan
Tester: Ashish Vishal

Cake-Walk

Math

PROBLEM:

Given H,X,Y,C. H-Total Numbers of Households. X,Y:- (X+floor(Y/2)) liters of water is consumed per week per Household. C:- Available water for a week. Find whether all the households can now have sufficient water to meet their requirements.

EXPLANATION:

If (X+floor(Y/2))\times H is less than or equal to C then print “YES” otherwise Print “NO”.

SOLUTIONS:

Tester's Solution
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define is insert
#define rep1(i,a,b) for(long long i=a;i<=b;i++)
#define F first
#define S second
#define file ifstream fin("input.txt");ofstream fout("output.txt");
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fr(n) for(long long i=0;i<n;i++)
#define rep(i,a,b) for(long long i=a;i<b;i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;

bool compare(pair<ll,ll>&a,pair<ll,ll>&b)
{
if (a.first != b.first) {
return a.first < b.first;
}
return a.second > b.second;
}

void solve()
{
ll h,x,y,c;

cin>>h>>x>>y>>c;
assert(h>=1&&h<=10&&y>=1&&y<=10&&x>=1&&x<=10);

y/=2;
ll use=h*(x+y);
(use<=c)?cout<<"YES\n":cout<<"NO\n";

}

int32_t main()
{
#ifndef ONLINE_JUDGE
freopen("inputf.in", "r", stdin);
freopen("outputf.in", "w", stdout);
#endif
fast;

ll t=1;
assert(t>=1&&t<=300);

cin>>t;
while(t--)
solve();
return 0;
}

int main()
{
int T;
cin >> T;
for(int i=1; i<=T; i++){
int H,x,y,C;

cin>> H >> x >> y >> C;

int check;
check = ((x/2)+y)*H;

if(check <= C){
cout<< "YES";
}

else{
cout<< "NO";
}
}
}



i m getting the wrong answer what could be the issue the out put matches