Skip to content

Instantly share code, notes, and snippets.

@GaZ3ll3
Created April 11, 2015 07:50
Show Gist options
  • Save GaZ3ll3/7c842423203123f941a3 to your computer and use it in GitHub Desktop.
Save GaZ3ll3/7c842423203123f941a3 to your computer and use it in GitHub Desktop.
google code jam 2015 qround
import sys
cases = int(raw_input())
for c in xrange(cases):
# read in misc problem constants
x, y, z = map(int, raw_input().split())
if x == 1:
print "Case #%d: GABRIEL" % ((c+1))
if x == 2:
if ((y * z)% 2 == 0):
print "Case #%d: GABRIEL" % ((c+1))
else:
print "Case #%d: RICHARD" % ((c+1))
if x == 3:
if ((y * z) % 3 == 0):
if (y == 1 or z == 1):
print "Case #%d: RICHARD" % ((c+1))
else:
print "Case #%d: GABRIEL" % ((c+1))
else:
print "Case #%d: RICHARD" % ((c+1))
if x == 4:
if ((y * z) % 4 == 0):
if (y == 1 or z == 1):
print "Case #%d: RICHARD" % ((c+1))
elif (y == 2 or z == 2):
print "Case #%d: RICHARD" % ((c+1))
elif (y == 3 or z == 3):
print "Case #%d: GABRIEL" % ((c+1))
else:
print "Case #%d: GABRIEL" % ((c+1))
else:
print "Case #%d: RICHARD" % ((c+1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment