.

.
Last edited on
but this is giving me WA
Not everyone here uses codechef. What is "WA"?

Your approach seems correct. Just be sure that you aren't double-counting pairs of recipes. Adding up the counts should be something like this:
1
2
3
4
5
6
7
8
9
unsigned result = 0;
for (i=0; i<31; ++i) {
    for (j=i+1; j<32; ++j) {
        if (i | j == 31) {
            result += count[i] * count[j];
        }
    }
}
return result;
closed account (z05DSL3A)
dhayden wrote:
Not everyone here uses codechef. What is "WA"?

"WA - wrong answer - your program ran successfully, but gave an incorrect answer. Most probably your program contains a bug, or you are not interpreting the problem text correctly."
Didn't we just do this one from someone else?

In addition to
FAQ - Frequently Asked Questions
we need
FUA - Frequently Unread Answers.

You are missing one case....
Suppose there are 3 Ingredients
aeiou
aeiou
aeiou

Your Code will show Zero output, But answer should be 3
So all you need to do is ans+=count[31]*(count[31]-1)/2
@changs98 thanks that was the case
closed account (E0p9LyTq)
Do NOT delete/modify your posts, that is VERY rude. This is not your own personal tutor service.

And could get your ignored in the future.
Last edited on
Topic archived. No new replies allowed.