Skip to content

Instantly share code, notes, and snippets.

@jsoffer
Created November 1, 2010 22:03
Show Gist options
  • Save jsoffer/658953 to your computer and use it in GitHub Desktop.
Save jsoffer/658953 to your computer and use it in GitHub Desktop.
from os import system as run
def pars(x): return (x*"(" + "1" + x*")")
def programa(x): return "int main () { return " + pars(x) + "; }\n"
# rango seleccionado al tanteo, manipulando para encontrar el primero que falla
for i in range(2**16 + 2**15 + 2**13 + 2**10,2**17):
print "---------- " + str(i) + " ----------"
fh = open ("parens.c", "w")
fh.write(programa(i))
fh.flush()
fh.close()
print "+++"
run ("gcc -Wall parens.c")
# No va a ser interrumpido por Ctrl-C; hace falta
# hacer Ctrl-Z y matar el proceso 'python' padre.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment