I have the following code.
CodeBlocks outputs NO
for the following input, but Codeforces outputs YES
?
For the following input:
1500 1500 1500 1 2 3
, the right output is NO
(correct in CodeBlocks), but it outputs YES
with the Codeforces "compiler" (aka custom invocation).
I've tried everything and I'm very much out of ideas.
#include <stdio.h>
#include <string.h>
int main()
{
int andrewGrapes, dmitryGrapes, michalGrapes;
int greenGrapes, purpleGrapes, blackGrapes;
int andrewCheck, dmitryCheck, michalCheck;
// how many grapes they want to eat
scanf("%d", &andrewGrapes); // green grapes only
scanf("%d", &dmitryGrapes); // purple and green
scanf("%d", &michalGrapes); // any grapes
// number of grapes
scanf("%d", &greenGrapes);
scanf("%d", &purpleGrapes);
scanf("%d", &blackGrapes);
if (greenGrapes >= andrewGrapes)
{
andrewCheck = 1;
greenGrapes = greenGrapes - andrewGrapes;
}
if (greenGrapes + purpleGrapes >= dmitryGrapes)
{
greenGrapes = greenGrapes - dmitryGrapes;
purpleGrapes = purpleGrapes - dmitryGrapes;
dmitryCheck = 1;
}
//if (greenGrapes + purpleGrapes + blackGrapes >= michalGrapes)
// michalCheck = 1;
if (andrewCheck == 1)
{
if (dmitryCheck == 1)
printf("YES");
} else printf("NO");
return 0;
}