C++20 sections · 1024 units
Open in Course

Team - Implementation

Complete solution

Here's the pseudocode:

read n
count := 0
for i from 1 to n do
 read a, b, c
 if a + b + c >= 2 then
 count := count + 1
 print count
``` The trick is that a, b, and c are either 0 or 1. Their sum counts how many teammates are sure about the problem. If the sum is 2 or more, at least two agree, so they'll submit. Read items, check condition, increment counter if true, print final count. The sum of three binary values (0 or 1) directly counts how many teammates are confident. If sum >= 2, at least two agree.