CATSDOGS - Editorial

The problem was not that difficult. Nevertheless, hat’s off to you @vijju123.

Unless I worked the arithmetic out myself, I could not bring myself to understand the thinking-process that went behind cats being greater than twice the number of dogs.

I relish reading your explanations. Thanks for making my day!

plzz help me
idont know where i am getting this wrong

link → CodeChef: Practical coding for everyone

i would be very thankful if you could check my code :grin: :grin:

Try test cases similar to this
1
6 1 16
3 cats sit on the dog. The other 3 cats walk.
So 4+(6-3)*4=16 which is true

1 Like

3 cat can’t sit on a dog, at max 2 cat can sit on a dog, according to given constrain, so result would be false.

long long int helped me bro tqs very much
#include <stdio.h>

int main(void) {
int n;
scanf("%d",&n);
while(n–)
{
long long int a,b,c,min,max,nc;
scanf("%ld%ld%ld",&a,&b,&c);
max=4*(a+b);
nc=2b;
if(nc>=a)
min=4
b;
if(nc<a)
min=4*(a-nc+b);
if(c%4!=0)
printf(“no\n”);
else
{
if(c>=min&&c<=max)
printf(“yes\n”);
else
printf(“no\n”);
}
}
this is my code i run it got 50 but now after i changed to long long int of a,b,c code got executed