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
\documentclass[12pt]{article} | |
\usepackage{fullpage} | |
\usepackage[fleqn]{amsmath} | |
\begin{document} | |
\begin{abstract} | |
\begin{center} | |
Equation Challenge | |
\end{center} |
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
package main | |
import "fmt" | |
func main() { | |
size := 7 | |
grid := make([][]int, size) | |
for k := 0; k < size; k++ { |
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
import bisect | |
import timeit | |
#Finds the Nth golumb number from the | |
#sequence x(n) using a binary search | |
def findNthGolumb(n, x, upto) : | |
pos = bisect.bisect(x, n, 1, upto) | |
return pos - 1 | |
#Creates the sequence x(n) where x(n) is k |
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
#Quine1 | |
e=r'''print "e=r''"+"'"+e+"''"+"'\n"+e''' | |
print "e=r''"+"'"+e+"''"+"'\n"+e | |
#Quine2 | |
x='%s=%s;print x%%("x",chr(39)+x+chr(39))';print x%("x",chr(39)+x+chr(39)) | |
#Quine3 | |
y="%" | |
z='y="%s"\nz=%s\nprint z%s(y,repr(z),y)' |
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
#1. The input is a list of rings. Each ring is a list of letters. | |
#2. Once you choose a letter from ring k then you can only choose letters from | |
# ring k, k + 1, ... Outermost ring is ring 0. And ring depth increases inwards. | |
#3. points[k] is the points for getting the letter chr(k + ord('A')) | |
from bisect import bisect, bisect_left | |
from time import time | |
try: | |
import psyco |
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
#!/usr/bin/env python | |
def partitions(n, curtot = 0, cur = []) : | |
if curtot == n : | |
yield cur | |
t = cur[-1] if cur else 1 | |
for i in xrange(t, n - curtot + 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
#!/usr/bin/env python | |
import timeit | |
graph = {'A': ['B', 'C'], | |
'B': ['C', 'D'], | |
'C': ['D'], | |
'D': ['C'], | |
'E': ['F'], | |
'F': ['C']} |
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
def permute(l) : | |
if len(l) == 1 : | |
yield l | |
else : | |
for i in range(len(l)) : | |
for j in permute(l[:i] + l[i + 1:]) : | |
yield [l[i]] + j | |
def combinations(l, r) : | |
if r == 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
.section .data | |
output: | |
.ascii "The processor Vendor ID is: " | |
vendor_id: | |
.ascii "xxxxYYYYzzzz\n" | |
.section .bss | |
.section .text |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <malloc.h> | |
#include <time.h> | |
#include <gmp.h> | |
long int NAIVE = 30; | |
typedef unsigned long int ulong; |
OlderNewer