This file contains 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
# 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""" |
This file contains 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
# 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""" |
This file contains 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
# 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 |
This file contains 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
""" | |
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) |
This file contains 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
""" | |
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): |
This file contains 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
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 |
This file contains 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
100 | |
3 8 | |
5 6 9 4 8 2 1 7 | |
3 1 | |
2 | |
3 100 | |
2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 | |
3 100 | |
1 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 | |
1000000 1 |
This file contains 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
""" | |
Used to solve google code jam 2013 Round 1B - Problem A - Osmos | |
Owner: Jamie Xu - [email protected] | |
""" | |
def osmos(): | |
""" | |
File Handle | |
""" | |
in_f = open('A-large.in', 'r') | |
out_f = open('output.txt', 'w') |
This file contains 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
Case #1: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Case #2: 1 2 7 3 9 10 4 12 14 5 11 15 6 8 13 | |
Case #3: 1 2 3 4 5 | |
Case #4: 2 1 3 7 6 12 4 5 8 13 9 10 11 14 15 16 17 18 19 20 | |
Case #5: 2 1 | |
Case #6: 1 | |
Case #7: IMPOSSIBLE | |
Case #8: IMPOSSIBLE | |
Case #9: 1 2 3 4 5 | |
Case #10: 1 2 5 7 11 12 14 17 19 20 3 4 6 8 9 10 13 15 16 18 |
NewerOlder