ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1880. Psych Up's Eigenvalues

My Accepted Solution in Java
Posted by Md johirul Islam 22 Jun 2015 19:26
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class T1880 {

public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
List<Integer> an=new ArrayList<Integer>();
List<Integer> bn=new ArrayList<Integer>();
List<Integer> cn=new ArrayList<Integer>();
int a=sc.nextInt();
int count=0;
int a1=a;
while(a1-->0)
{
int n=sc.nextInt();
}

int b=sc.nextInt();
int b1=b;
while(b1-->0)
{
int n=sc.nextInt();
}

int c=sc.nextInt();
int c1=c;
while(c1-->0)
{
int n=sc.nextInt();
}

if(a>=b && a>=c)
{
for (Integer integer : an) {
if(bn.contains(integer)&&cn.contains(integer))
count++;
}
}

else if(b>=a && b>=c)
{
for (Integer integer : bn) {
if(an.contains(integer)&&cn.contains(integer))
count++;
}
}
else if(c>=b && c>=a)
{
for (Integer integer : cn) {
if(bn.contains(integer)&&bn.contains(integer))
count++;
}
}

System.out.println(count);

}

}