当前位置:网站首页>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;
}
如果对您有帮助,点个关注吧,持续更新中,谢谢支持。如果有问题或错误,欢迎指出与我联系,谢谢。
边栏推荐
猜你喜欢
【Promise.allSettled】手写Promise.allSettled方法
Cyanine5 tetrazine,Cy5 tetrazineCY5四嗪,1427705-31-4
【NodeJs篇】fs文件系统模块
Open source summer | I have nothing to do during the epidemic, I made a button display box special effect to display my blog
2021年9月电子学会图形化三级编程题解析含答案:绘制图形
DSPE-PEG-NH2,DSPE-PEG-amine,474922-26-4,磷脂-聚乙二醇-氨基科研试剂
2021年9月电子学会图形化二级编程题解析含答案:画正多边形
Fluorescein-PEG-CLS,胆固醇-聚乙二醇-荧光素用于缩短包封周期
牛客多校第6场M(dp或者递推)
orbslam2实验记录-----稠密建图
随机推荐
2.5W 字详解线程与锁了,面试随便问!!
发光的几何图形canvasjs特效
R文件找不到问题
R file not found problem
Vscode LeetCode 教程
智文最终版本
21天学习第二天-类型转换
XDOJ - count the number of positive integers
CF803F(容斥原理+莫比乌斯函数)
Superficial understanding of ports
【wpf】Bingding的方向和触发的时机
@Transactional
差分信号简述
mysql5.7安装教程(附下载链接)
slam测评工具evo的安装与使用
what‘s the meaning of build-essential
Fluorescein-PEG-CLS,胆固醇-聚乙二醇-荧光素用于缩短包封周期
QT With OpenGL(泛光)(Bloom)
开源一夏 | RuntimeException 子类
【NodeJs篇】fs文件系统模块