Skip to content

Instantly share code, notes, and snippets.

@Jack-Saleem
Created January 15, 2016 13:18
Show Gist options
  • Select an option

  • Save Jack-Saleem/83274c9a310bf0b11b24 to your computer and use it in GitHub Desktop.

Select an option

Save Jack-Saleem/83274c9a310bf0b11b24 to your computer and use it in GitHub Desktop.
Codeforces 231A Team program in java
import java.util.Scanner;
public class Team
{
public static void main(String args[])
{
Scanner ip = new Scanner(System.in);
int x=ip.nextInt();
int ctr=0,s=0;
int[] a = new int[3];
int[] b = new int[1001];
for(int i=1;i<=x;i++)
{
for(int j=0;j<=2;j++)
{
a[j]=ip.nextInt();
s=a[0]+a[1]+a[2];
}
b[i]=s;
if(b[i]>=2)
ctr++;
}
System.out.println(ctr);
}
}
@MahmoudAdel9
Copy link
Copy Markdown

import java.util.Scanner;

public class CodeForces {

public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int count = 0 ;
    for (int i = 0; i < n; i++) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if ((a ==1 && b == 1) || (a ==1 && c == 1) || (b ==1 && c == 1)) 
            count ++ ; 

    }
    System.out.println(count);
}

}

@MahmoudAdel9
Copy link
Copy Markdown

import java.util.Scanner;

public class CodeForces {

public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int count = 0 ;
    for (int i = 0; i < n; i++) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if ((a ==1 && b == 1) || (a ==1 && c == 1) || (b ==1 && c == 1)) 
            count ++ ; 

    }
    System.out.println(count);
}

}

@Sangharshvmore
Copy link
Copy Markdown

import java.util.*;

public class TwohundthrityoneA {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int count =0; // to count result
for(int i=0;i<n;i++){
int idcount=0; // for indiviual dicision

        int a = sc.nextInt();
        if(a==1){
            idcount++;
        }

        int b = sc.nextInt();
        if(b==1){
            idcount++ ;
        }
        int c = sc.nextInt();
        if(c==1){
            idcount++ ;
        }
        if(idcount>=2){
            count++ ;
        }
      }
     System.out.println(count);

     sc.close();
     }
}

here is my code for this problem hope helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment