a774: Team ( 團隊 )
Tags : 800 brute force greedy
Accepted rate : 45人/48人 ( 94% ) [非即時]
評分方式:
Tolerant

最近更新 : 2022-07-17 21:11

Content

One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution.

This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution.

有一天,三個最好的朋友 Petya、Vasya 和 Tonya 決定組成一個團隊並參加編程比賽。 在編程競賽期間,參與者通常會遇到幾個問題。 早在開始之前,朋友們就決定如果至少有兩個人確定解決方案,他們才會嘗試解決該問題。 否則,他們不會寫出問題的解決方案。

本次比賽為參與者提供了 n 個問題。 我們知道每個問題,哪位朋友對解決方案有把握。 幫助朋友找出他們將寫出解決方案的問題的數量。

Input

The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces.

第一個輸入行包含一個整數 n (1 ≤ n ≤ 1000) — 比賽中的問題數。 然後 n 行每行包含三個整數,每個整數是 0 或 1。如果行中的第一個數字等於 1,則 Petya 確定問題的解決方案,否則他不確定。 第二個數字顯示了 Vasya 對解決方案的看法,第三個數字顯示了 Tonya 的看法。 行上的數字用空格分隔。

Output

Print a single integer — the number of problems the friends will implement on the contest.

打印一個整數 — 朋友們將在比賽中嘗試解答的問題數量。

Sample Input #1
3
1 1 0
1 1 1
1 0 0
Sample Output #1
2
Sample Input #2
2
1 0 0
0 1 1
Sample Output #2
1
測資資訊:
記憶體限制: 64 MB
公開 測資點#0 (5%): 0.5s , <1K
公開 測資點#1 (5%): 0.5s , <1K
公開 測資點#2 (5%): 0.5s , <1K
公開 測資點#3 (5%): 0.5s , <1K
公開 測資點#4 (5%): 0.5s , <1K
公開 測資點#5 (5%): 0.5s , <1K
公開 測資點#6 (5%): 0.5s , <1K
公開 測資點#7 (5%): 0.5s , <1K
公開 測資點#8 (5%): 0.5s , <1K
公開 測資點#9 (5%): 0.5s , <1K
公開 測資點#10 (5%): 0.5s , <1K
公開 測資點#11 (5%): 0.5s , <1K
公開 測資點#12 (5%): 0.5s , <1K
公開 測資點#13 (5%): 0.5s , <1K
公開 測資點#14 (5%): 0.5s , <1K
公開 測資點#15 (5%): 0.5s , <1K
公開 測資點#16 (5%): 0.5s , <1K
公開 測資點#17 (5%): 0.5s , <1K
公開 測資點#18 (5%): 0.5s , <1K
公開 測資點#19 (5%): 0.5s , <1K
Hint :

In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it.

In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution.

在第一個示例中,Petya 和 Vasya 確信他們知道如何解決第一個問題,並且他們三個都知道如何解決第二個問題。 這意味著他們將為這些問題編寫解決方案。 第三個問題的解法只有 Petya 有把握,但這還不夠,朋友們也不會接受。

在第二個示例中,朋友們只會實施第二個問題,因為 Vasya 和 Tonya 對解決方案很確定。

 

Tags:
800 brute force greedy
出處:
Codeforces Round #143 [管理者:
lamkinun@gma... (Kinda Lam)
]


ID User Problem Subject Hit Post Date
沒有發現任何「解題報告」