Skip to content

Instantly share code, notes, and snippets.

@xtoss
xtoss / output.txt
Created May 4, 2013 18:32
Result for Large Data Set for Google code jam 2013 Round 1B - Problem A - Osmos
Case #1: 0
Case #2: 0
Case #3: 0
Case #4: 1
Case #5: 1
Case #6: 20
Case #7: 3
Case #8: 20
Case #9: 20
Case #10: 5
@xtoss
xtoss / Pogo.py
Created May 12, 2013 13:34
Python solution for google code jam 2013 Round 1C - Problem B - Pogo: http://code.google.com/codejam/contest/2437488/dashboard#s=p1
"""
Used to solve google code jam 2013 Round 1C - Problem B - Pogo
Owner: Jamie Xu - [email protected]
"""
import math
def Pogo():
in_f = open('A-large.in', 'r')
out_f = open('output.txt', 'w')
num_of_case = int(in_f.readline().rstrip('\n'))
for i in range(1, num_of_case+1):
@xtoss
xtoss / Consonants.py
Created May 12, 2013 13:40
Python solution for google code jam 2013 Round 1C - Problem A - Consonants: https://code.google.com/codejam/contest/2437488/dashboard#s=p0
"""
Used to solve google code jam 2013 Round 1C - Problem A - Consonants
Owner: Jamie Xu - [email protected]
"""
def Consonants():
in_f = open('A-small-attempt0.in', 'r')
out_f = open('output.txt', 'w')
num_of_case = int(in_f.readline().rstrip('\n'))
for i in range(1, num_of_case+1):
solve_case(in_f, out_f, i)
@xtoss
xtoss / minesweeper_master.py
Created April 13, 2014 02:01
Python solution for Problem C. Minesweeper Master - Google Code Jam 2014
# Google Code Jam 2014
# Problem C. Minesweeper Master
# https://code.google.com/codejam/contest/2974486/dashboard#s=p2
# Author: jamie.xu - https://github.com/eytoss
PROBLEM_ID = "C" # A B or C
PROBLEM_SIZE = "large"
# `impossible` look up tables, used as short cut
# G4[9] == 1 means 9 mines for a 4 by 4 grid is impossible
# actually in my algorithm, it might just check G3[2] depending where I put this short-cut
@xtoss
xtoss / deceitful_war.py
Created April 13, 2014 02:35
Python solution for Problem D. Deceitful War - Google Code Jam 2014
# Google Code Jam 2014
# Problem D. Deceitful War
# https://code.google.com/codejam/contest/2974486/dashboard#s=p3
# Author: jamie.xu - https://github.com/eytoss
import copy
PROBLEM_ID = "D" # A B or C
PROBLEM_SIZE = "large"
def run():
"""I/O handler"""
@xtoss
xtoss / cookie_clicker.py
Created April 13, 2014 02:41
Python solution for Problem B. Cookie Clicker - Google Code Jam 2014
@xtoss
xtoss / magic_trick.py
Created April 13, 2014 02:43
Python solution for Problem A. Magic Trick - Google Code Jam 2014
# google code jam 2014
# Problem A. Problem A. Magic Trick
# https://code.google.com/codejam/contest/2974486/dashboard#s=p0
# Author: jamie.xu - https://github.com/eytoss
PROBLEM_ID = "A" # A B or C
PROBLEM_SIZE = "small"
def run():
"""I/O handler"""