PRINCSDJVU - Editorial

Practice

Author: Pramod Rao

DIFFICULTY:

MEDIUM

EXPLANATION:

The bug in this code is on these line:

else if (b = 3) {
	cout << "YES\n";
} 

We can see that because of this b = 3 condition, our code won’t ever go to the following else condition. Hence, we need to find a case where a = 0 and b != {0, 2, 3}. We can find this with a simple brute force. One such value of n that gives these a and b is n = 107.

1 Like