Explanation
The simplest solution is to input three integers per row and check if their sum is greater than or equal to two.
Implementation
Time Complexity:
C++
#include <iostream>using namespace std;int main() {int num = 0;int n;cin >> n;for (int i = 0; i < n; i++) {int a, b, c;cin >> a >> b >> c;if (a + b + c >= 2) { num++; }}cout << num << '\n';}
Java
import java.io.*;import java.util.*;public class Team {public static void main(String[] args) {Kattio io = new Kattio();int num = 0;int n = io.nextInt();for (int i = 0; i < n; i++) {int a = io.nextInt();int b = io.nextInt();
Python
sols = 0for _ in range(int(input())):sols += sum(int(i) for i in input().split()) >= 2print(sols)
Join the USACO Forum!
Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!