Skip to content

Instantly share code, notes, and snippets.

View okaq's full-sized avatar

AQ okaq

  • okaq.com
  • USA
  • 18:45 (UTC -05:00)
View GitHub Profile
@okaq
okaq / A.py
Created May 9, 2011 01:12
Solution: Bot Trust (Google Code Jam 2011 Qualification Round Problem A)
import sys
fin = file(sys.argv[1])
fout = open(sys.argv[2], 'w')
lines = fin.readlines()
tests = int(lines[0])
def getNext(c):
for step in range(index, 2 * steps, 2):
if ca[step] == c:
return int(ca[step+1])
@okaq
okaq / Bs.js
Created May 11, 2011 19:34
Solution: Magicka (Google Code Jam 2011 Qualification Round Problem B)
/* Solution: Magicka (Google Code Jam 2011 Qualification Round)
* created by: [email protected]
* on: 05/11/2011
* run: node Bs.js infile outfile
*/
var fs = require('fs');
/* argv test
console.log('ok');
@okaq
okaq / Cs.py
Created May 13, 2011 00:40
Solution: Candy Splitting (Google Code Jam 2011 Qualification Round Problem C)
import sys
fin = file(sys.argv[1])
fout = open(sys.argv[2], 'w')
lines = fin.readlines()
tests = int(lines[0])
candys0 = [map(int, line.split()) for line in lines]
def test0(a): return not (len(a) == 1)
candys = filter(test0, candys0)
data = []
@okaq
okaq / Ds.py
Created May 13, 2011 01:13
Solution: GoroSort (Google Code Jam 2011 Qualification Round Problem D)
import sys
fin = file(sys.argv[1])
fout = open(sys.argv[2], 'w')
lines = fin.readlines()
goros0 = [map(int, line.split()) for line in lines]
goros = []
tests = goros0.pop(0)
for i in range(1, len(goros0), 2):
@okaq
okaq / al.py
Created May 20, 2011 13:29
Solution: Alien Language (Google Code Jam 2009 Qualification Round Problem A)
import string, sys
import re
"""
ab = {"a":1,"b":2,"c":3,"d":4,"e":5,
"f":6,"g":7,"h":8,"i":9,"j":10,
"k":11,"l":12,"m":13,"n":14,"o":15,
"p":16,"q":17,"r":18,"s":19,"t":20,
"u":21,"v":22,"w":23,"x":24,"y":25,"z":26}
"""
@okaq
okaq / fc.py
Created May 21, 2011 16:46
Solution: FreeCell Statistics(Google Code Jam 2011 Round 1A Problem A)
import sys
import math
# files
fin = file(sys.argv[1])
fout = open(sys.argv[2], 'w')
lines = fin.readlines()
tests = int(lines[0])
def possible(pg, pd):
@okaq
okaq / tkw.py
Created May 22, 2011 20:32
Solution: The Killer Word(Google Code Jam 2011 Round 1A Problem B)
import sys
from string import ascii_lowercase
# files
fin = file(sys.argv[1])
fout = open(sys.argv[2], 'w')
lines = fin.readlines()
tests = int(lines[0])
# parse
@okaq
okaq / st.py
Created May 24, 2011 15:33
Solution: Square Tiles(Google Code Jam 2011 Round 1C Problem A)
import sys
# files
fin = file(sys.argv[1])
fout = open(sys.argv[2], 'w')
lines = fin.readlines()
tests = int(lines[0])
# parse
indexes = [1]
@okaq
okaq / A.py
Created August 7, 2011 18:15
Solution: Runs (Google Code Jam 2011 World Finals Problem A)
"""
"" Solution: Runs (Google Code Jam 2011 World Finals Problem A)
"" by: [email protected]
"" run: python A.py infile outfile
"""
import string
import sys
from datetime import datetime
from itertools import permutations
@okaq
okaq / E.py
Created September 25, 2011 15:33
Solution: Google Royale (Google Code Jam 2011 World Finals Problem E)
"""
"" Solution: Google Royale (Google Code Jam 2011 World Finals Problem E)
"" by: [email protected]
"" run: python E.py infile outfile
"""
import sys
# files
fin = file(sys.argv[1])