当前位置:网站首页>codeforces 231A.Team
codeforces 231A.Team
2022-08-08 17:53:00 【袗亦】
活动地址:CSDN21天学习挑战赛
作者:zhenyi
子专栏:codeforces800
专栏:codeforces
A. Team
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
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.
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.
Output
Print a single integer — the number of problems the friends will implement on the contest.
Examples
input
3 1 1 0 1 1 1 1 0 0
output
2
input
2 1 0 0 0 1 1
output
1
Note
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和Tonya决定组成一个团队,参加编程比赛。在编程比赛中,参赛者通常会遇到一些问题。在开始之前很久,朋友们就决定,如果至少有两个人确定解决方案,他们将实现一个问题。否则,朋友不会写出问题的解决方案。
这场比赛为参赛者提供了n个问题。对于我们所知道的每一个问题,哪个朋友对解决方案有把握。帮助你的朋友找出他们可以写出解决方案的问题的数量。
#include<iostream>
using namespace std;
int main()
{
int a,b,c,sum = 0,n;
cin >> n;
while(n--)
{
cin >> a >> b >> c;
if(a + b + c > 1)
sum++;
}
cout << sum;
return 0;
}
如果对您有帮助,点个关注吧,持续更新中,谢谢支持。如果有问题或错误,欢迎指出与我联系,谢谢。
边栏推荐
猜你喜欢
随机推荐
what‘s the meaning of xenial
企业“数字化转型”成功的2个必备条件!
【云图说】第252期 初识云速建站服务
百度分享插件的使用
2021年9月电子学会图形化三级编程题解析含答案:计算平均分
canvas城市灯火夜景动画js特效
Go源码之原子操作(atomic)
阿里巴巴云原生大数据运维平台 SREWorks 正式开源
同态加密:正则嵌入、理想格和RLWE问题
2 prerequisites for the success of "digital transformation" of enterprises!
How big is 1dp!
Cyanine5 tetrazine,Cy5 tetrazineCY5四嗪,1427705-31-4
右上角按钮圆形扩散导航菜单js特效
记录贴:pytorch学习Part3
poj1363 Rails(栈模拟)
元宇宙三巨头Animoca Brands、Yuga Labs、Gala多维度对比,谁才是未来?
2021年9月电子学会图形化三级编程题解析含答案:接红包游戏
CS231n:11 生成模型
【Promise.allSettled】手写Promise.allSettled方法
记录贴:pytorch学习Part4









