My issue
In the code, I first check if 2 dishes can be made and then verify if the input can make the required number of dishes. Is this approach correct? I am getting the desired output but not for all test cases.
My code
#include <stdio.h>
int main(void) {
// your code goes here
int t;
scanf("%d",&t);
while(t--)
{
int n,a,b,c;
scanf("%d%d%d%d",&n,&a,&b,&c);
if(b-a>=c && a+c>=n)
{
printf("YES\n");
}
else
{
printf("NO\n");
}
}
return 0;
}
Problem Link: CodeChef: Practical coding for everyone