Skip to content

Instantly share code, notes, and snippets.

@CraigRodrigues
Last active August 3, 2016 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CraigRodrigues/d6c38e2d5f42031b5ee1f684046de7c0 to your computer and use it in GitHub Desktop.
Save CraigRodrigues/d6c38e2d5f42031b5ee1f684046de7c0 to your computer and use it in GitHub Desktop.
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