Created
January 15, 2016 13:18
-
-
Save Jack-Saleem/83274c9a310bf0b11b24 to your computer and use it in GitHub Desktop.
Codeforces 231A Team program in java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | |
| } | |
| } |
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);
}
}
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
import java.util.Scanner;
public class CodeForces {
}