Created
July 24, 2017 15:08
-
-
Save rvndbalaji/05810d294e9f6abf9561c16465eee84d to your computer and use it in GitHub Desktop.
Compare the triplets - HackerRank Challenge - https://www.hackerrank.com/challenges/compare-the-triplets
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
#include <math.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <limits.h> | |
#include <stdbool.h> | |
int main() | |
{ | |
int a0; | |
int a1; | |
int a2; | |
scanf("%d %d %d", &a0, &a1, &a2); | |
int b0; | |
int b1; | |
int b2; | |
int p; | |
int ali=0; | |
int bob = 0; | |
scanf("%d %d %d", &b0, &b1, &b2); | |
int result_size = 2; | |
if(a0<b0) | |
{ | |
bob++; | |
} | |
else if(a0>b0) | |
{ | |
ali++; | |
} | |
if(a1<b1) | |
{ | |
bob++; | |
} | |
else if(a1>b1) | |
{ | |
ali++; | |
} | |
if(a2<b2) | |
{ | |
bob++; | |
} | |
else if(a2>b2) | |
{ | |
ali++; | |
} | |
int result[2]; | |
result[0] = ali; | |
result[1] = bob; | |
for(int result_i = 0; result_i < result_size; result_i++) | |
{ | |
if(result_i) { | |
printf(" "); | |
} | |
printf("%d", result[result_i]); | |
} | |
puts(""); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment