zcmu-1418 team

【题述】

zcmu-1418 team

zcmu-1418 team

 

题意:

    很水,多组输入,每一组输入一个n,输入n行,每行三个数字(只能是0/1),一行有2个及以上的1的记为一个有效行,求每组的有效行

#include <iostream>

#include <cmath>

#include <cstring>

using namespace std;

int main(){

    int n,i,count,flag,r;

    while(cin>>n){

        int a[5];

        flag=0;

       

        memset(a, 0, sizeof(a));

        for(i=0;i<n;i++){

            count=0;

            for(r=0;r<3;r++){

                cin>>a[r];

                if(a[r]==1){

                    count++;

                }

            }

            if(count>=2)

                flag++;

           

        }

        cout<<flag<<endl;

    }

    return 0;

}

【便于搜索】

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.