➽ Problem:-
https://www.hackerrank.com/challenges/compare-the-triplets/problem
➽ Solution:-
import
java.util.*;
import
java.io.*;
public class
Solution
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int a0 = sc.nextInt();
int a1 = sc.nextInt();
int a2 = sc.nextInt();
int b0 = sc.nextInt();
int b1 = sc.nextInt();
int b2 = sc.nextInt();
int Alice = 0, Bob = 0;
if(a0>b0)
{
Alice++;
}
else if(b0>a0)
{
Bob++;
}
if(a1>b1)
{
Alice++;
}
else if(b1>a1)
{
Bob++;
}
if(a2>b2)
{
Alice++;
}
else if(b2>a2)
{
Bob++;
}
System.out.println(Alice + "
" + Bob);
}
}
0 Comments
Please do not enter any spam link in the comment section.