231A - Team - CodeForces Solution


brute force greedy *800

Please click on ads to support us..

Python Code:

list = [[],
        [],
        []]
n = int(input())
count = 0
for i in range(n):
    c = 0
    a = input().split()
    for j in range(len(a)):
        a[j] = int(a[j])
    for j in range(3):
        list[j].append(a[j])
        if list[j][i] == 1:
            c += 1
    if c > 1:
        count += 1
print(count)

C++ Code:

#include <iostream>
using namespace std;
int main(){
    int n=0,y=0;
    cin>>n;
    int x[n][3];
    for(int i=0;i<n;i++){
        for(int j=0;j<3;j++){
    cin>>x[i][j];}}
    for(int i=0;i<n;i++){
    if ((x[i][0]==1&&x[i][1]==1)||(x[i][0]==1&&x[i][2]==1)||(x[i][1]==1&&x[i][2]==1))
    y+=1;
    }
    cout<<y;
    return 0;
    
    
}


Comments

Submit
0 Comments
More Questions

Cyclic shifts
Zoos
Build a graph
Almost correct bracket sequence
Count of integers
Differences of the permutations
Doctor's Secret
Back to School
I am Easy
Teddy and Tweety
Partitioning binary strings
Special sets
Smallest chosen word
Going to office
Color the boxes
Missing numbers
Maximum sum
13 Reasons Why
Friend's Relationship
Health of a person
Divisibility
A. Movement
Numbers in a matrix
Sequences
Split houses
Divisible
Three primes
Coprimes
Cost of balloons
One String No Trouble