.

Mar 9, 2019 at 12:45pm
.
Last edited on Mar 9, 2019 at 6:09pm
Mar 9, 2019 at 1:30pm
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;
Mar 9, 2019 at 1:53pm
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."
Mar 9, 2019 at 2:25pm
Didn't we just do this one from someone else?

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

Mar 9, 2019 at 2:41pm
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
Mar 9, 2019 at 6:10pm
@changs98 thanks that was the case
Mar 9, 2019 at 6:15pm
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 Mar 9, 2019 at 6:16pm
Topic archived. No new replies allowed.