当前位置:网站首页>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;
}
如果对您有帮助,点个关注吧,持续更新中,谢谢支持。如果有问题或错误,欢迎指出与我联系,谢谢。
边栏推荐
猜你喜欢
随机推荐
21天学习第四天--流程控制
新版松鼠as换源操作
rv和sv的区别
文件传输-FTP使用简介
Prometheus+Grafana监控系统
21天学习第二天-类型转换
差分信号简述
spark学习笔记(八)——sparkSQL概述-定义/特点/DataFrame/DataSet
R文件找不到问题
List<String>用空串替换null值,并且都加上单引号,并且转为字符串用,分割
js温度计插件自定义数值
TCP协议详解
2 prerequisites for successful "digital transformation" of enterprises!
智文最终版本
瑞利衰落条件下扩频通信系统误码率仿真
2021年9月电子学会图形化二级编程题解析含答案:画正多边形
【DB运营管理/开发解决方案】上海道宁为您提供提高工作便利性的集成开发工具——Orange
套接字的概念
Vscode LeetCode 教程
The new version of squirrel as source change operation