我是靠谱客的博主 无辜帆布鞋,最近开发中收集的这篇文章主要介绍Codeforces 231A.Team(brute force, greedy)The title informationAnswer,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

上一篇博客:第十二届蓝桥杯省赛第一场C/C++ B组真题及部分题解

 写在前面:大家好!我是晴空๓。如果博客中有不足或者的错误的地方欢迎在评论区或者私信我指正,感谢大家的不吝赐教。我的唯一博客更新地址是:https://ac-fun.blog.csdn.net/。非常感谢大家的支持。一起加油,冲鸭!
用知识改变命运,用知识成就未来!加油 (ง •̀o•́)ง (ง •̀o•́)ง

原题链接:Codeforces 231A.Team

文章目录

  • The title information
    • Problem description
    • Input
    • Output
    • Examples
      • input one
      • output one
      • input two
      • output two
    • Note
  • Answer
    • The title mean
    • Ideas
    • AC code

The title information

Problem description

 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 one

3
1 1 0
1 1 1
1 0 0

output one

2

input two

2
1 0 0
0 1 1

output two

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.

Answer

The title mean

 题目大概的意思是三个同学组队参加 ACM,只有当两个或者两个以上同学确定他们的题目可以 Accepted 的时候他们才会提交题目。问最后他们一共会提交几次题目。输入一个字母 n 表示比赛一共有几道题目,接下来的 n 行输入 n 条数据,没条数据一次表示三位同学是否确定他们的题目可以 Accepted,如果为 1 表示确定,0 表示不确定。最后输出正常比赛他们确定提交几道题目。

Ideas

 因为题目的数据范围比较小,所以可以直接边输入边统计,最后输出结果即可。

AC code

#include<iostream>
#include<cstdio>

using namespace std;
int n, ans;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a, b, c, cnt = 0;
		cin >> a >> b >> c;
		if (a) cnt++;
		if (b) cnt++;
		if (c) cnt++;
		if (cnt >= 2) ans++;
	}
	cout << ans;
	return 0;
}

未完待续,持续更新中……
嘿嘿

最后

以上就是无辜帆布鞋为你收集整理的Codeforces 231A.Team(brute force, greedy)The title informationAnswer的全部内容,希望文章能够帮你解决Codeforces 231A.Team(brute force, greedy)The title informationAnswer所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(64)

评论列表共有 0 条评论

立即
投稿
返回
顶部