# Compare the Triplets Hackerrank Problem coderinme

## Compare the Triplets

Alice and Bob each created one problem for HackerRank Compare the Triplets. A reviewer rates the two challenges, awarding points on a scale from 1 to 100 for three categories: problem clarity, originality, and difficulty.

We define the rating for Alice’s challenge to be the triplet A=(a0,a1,a2), and the rating for Bob’s challenge to be the triplet B=(b0,b1,b2).

Your task is to find their comparison scores by comparing a0 with b0, a1 with b1, and a2 with b2.

If ai>bi, then Alice is awarded 1 point.
If ai If ai=bi, then neither person receives a point.
Given A and B, can you compare the two challenges and print their respective comparison points?

Input Format

The first line contains 3 space-separated integers, a0, a1, and a2, describing the respective values in the triplet.
The second line contains 3 space-separated integers, b0, b1, and b2, describing the respective values in the triplet.

Constraints

• 1<=ai<=100
• 1<=bi<=100

Output Format

Print two space-separated integers denoting the respective comparison scores earned by Alice and Bob.

Sample Input

5 6 7
3 6 10
Sample Output

1 1

Explanation

In this example:

• A=(a0,a1,a2)=(5,6,7)
• B=(b0,b1,b2)=(3,6,10)

Now, let’s compare each individual score:

• a0>b0, so Alice receives  point.
• a1=b1, so nobody receives a point.
• a2<b2, so Bob receives  point.

Alice’s comparison score is 1, and Bob’s comparison score is1 . Thus, we print 1 1 (Alice’s comparison score followed by Bob’s comparison score) on a single line.

#include <bits/stdc++.h>

using namespace std;
int a=0,b=0;
void cal(int x,int y)
{
if(x>y)
a++;
else if(x<y)
b++;
}

int main() {
int a0;
int a1;
int a2;
cin >> a0 >> a1 >> a2;
int b0;
int b1;
int b2;
cin >> b0 >> b1 >> b2;
cal(a0,b0);
cal(a1,b1);
cal(a2,b2);

cout<<a<<" "<<b;

return 0;
}

Explanation

After taking input for Alice and Bob , we are calling ” cal function” which will calculate Alice’s point in a and Bob’s point in b and then call it again two times for a1,b1and a2,b2.then we print the result.

###### More about C++ condition According to Cprogramming.com

he ability to control the flow of your program, letting it make decisions on what code to execute, is valuable to the programmer. The if statement allows you to control if a program enters a section of code or not based on whether a given condition is true or false. One of the important functions of the if statement is that it allows the program to select an action based on the user’s input. For example, by using an ‘ if ‘ statement to check a user-entered password, your program can decide whether a user is allowed access to the program.