#K7621. Quality Control: Counting Passing Products
Quality Control: Counting Passing Products
Quality Control: Counting Passing Products
You are given the results of quality control tests for N products. Each product is tested using three criteria. The result for each product is represented as a binary string of length 3, where each character is either '1'
(pass) or '0'
(fail). A product is considered to have passed overall quality control if and only if it passes at least two out of the three tests.
In mathematical terms, if we define f(s) as the number of '1'
characters in the string s, then a product passes if:
\(f(s) \ge 2\)
Your task is to count the number of products that pass the quality control.
inputFormat
The input is given via standard input and consists of multiple lines. The first line contains a single integer N
— the number of products. Each of the following N
lines contains a binary string of length 3 representing the test results for a product.
Example:
5 110 101 000 111 011
outputFormat
Output a single integer to standard output — the number of products that pass the quality control (i.e. products with at least two '1's in their test result).
## sample5
110
101
000
111
011
4