Skip to content

Instantly share code, notes, and snippets.

@CraigRodrigues CraigRodrigues/triplets.c
Last active Aug 3, 2016

Embed
What would you like to do?
HackerRank - Algorithms - Warmup - Compare the Triplets
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(){
int alice_score = 0;
int bob_score = 0;
int a0;
int a1;
int a2;
scanf("%d %d %d",&a0,&a1,&a2);
int b0;
int b1;
int b2;
scanf("%d %d %d",&b0,&b1,&b2);
(a0 == b0) ? : ((a0 > b0) ? alice_score++ : bob_score++);
(a1 == b1) ? : ((a1 > b1) ? alice_score++ : bob_score++);
(a2 == b2) ? : ((a2 > b2) ? alice_score++ : bob_score++);
printf("%i %i", alice_score, bob_score);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.