This file contains hidden or 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 checkdist(a,b,c,d,e,f,g): | |
| array = sorted([abs(0-a),abs(1-b),abs(2-c),abs(3-d),abs(4-e),abs(5-f),abs(6-g)]) | |
| i = 0 | |
| goodanswer = 1 | |
| while (i + 1 < len(array)): | |
| if (array[i] == array[i + 1]): | |
| goodanswer = 0 | |
| i += 1 | |
| if (goodanswer == 1): | |
| print a,b,c,d,e,f,g,array,"GOOD" |
This file contains hidden or 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; | |
| use Memoize; | |
| memoize(pullcard); | |
| # Dredger + Faithless Looting + LED + Dredger | |
| # AABC | |
| # Dredger + LED/Putrid Imp + Faithless Looting/Careful Study/Breakthrough/Cephalid Coliseum + Rainbow land |
This file contains hidden or 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
| from collections import defaultdict | |
| import string | |
| import os | |
| def deckstring(deck): | |
| return int("1" * deck[0] + "2" * deck[1] + "3" * deck[2] + "4" * deck[3] + "5" * deck[4] + "6" * deck[5] + "7" * deck[6] + "8" * deck[7] + "9" * deck[8]) | |
| def breakdown(deck): | |
| deck = str(deck) | |
| return [deck.count("1"),deck.count("2"),deck.count("3"),deck.count("4"),deck.count("5"),deck.count("6"),deck.count("7"),deck.count("8"),deck.count("9")] |
This file contains hidden or 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
| from random import choice | |
| from copy import deepcopy | |
| import string | |
| def do_save(current_cards, save_file="mydeck.txt"): | |
| filehandle = file(save_file, "w") | |
| for card in current_cards: | |
| filehandle.writelines(card) | |
| filehandle.close() | |
| print "Current card list saved." |
This file contains hidden or 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 solve(polynomial): | |
| polymatrix = [] | |
| for i in range(len(polynomial)): | |
| polymatrix.append([]) | |
| for j in range(len(polynomial)): | |
| polymatrix[i].append(polynomial[i][0] ** j) | |
| polymatrix[i].append(polynomial[i][-1]) | |
| for i in range(len(polymatrix)): | |
| divisor = polymatrix[i][i] | |
| for j in range(len(polymatrix[0])): |
This file contains hidden or 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
| from multiprocessing import Pool | |
| import gmpy | |
| bigmod = 1000000007 | |
| class Memoize: # stolen from http://code.activestate.com/recipes/52201/ | |
| """Memoize(fn) - an instance which acts like fn but memoizes its arguments | |
| Will only work on functions with non-mutable arguments | |
| """ |
This file contains hidden or 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
| echo "o | |
| n | |
| p | |
| 1 | |
| n | |
| w"|sudo fdisk /dev/sda | |
| mke2fs -jv /dev/sda1 | |
| export LFS=/mnt/lfs |
This file contains hidden or 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
| """Minecraft crafting calculator""" | |
| from math import ceil | |
| from copy import copy | |
| from difflib import get_close_matches | |
| from re import search | |
| from collections import defaultdict | |
| RAW_MATERIALS = set([ | |
| "Iron Ore", |
This file contains hidden or 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
| from time import sleep | |
| import curses | |
| import random | |
| screenwidth = 22 | |
| screenheight = 22 | |
| if __name__ == "__main__": | |
| # Build it all up | |
| path = [-1 for x in range(screenwidth) for y in range(screenheight)] |
This file contains hidden or 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
| print 1, sum([i for i in range(1000) if i % 3 == 0 or i % 5 == 0]) | |
| print 2, sum([j for j in [int((((1.0 + 5.0 ** .5) / 2) ** i - ((1 - 5 ** .5) / 2) ** i) / (((1.0 + 5.0 ** .5) / 2) - ((1 - 5 ** .5) / 2))) for i in range(1000)] if j % 2 == 0 and j < 4000000]) | |
| print 3, max([i for i in reduce( (lambda r,x: (r.difference_update(range(x*x,int(600851475143 ** .5),2*x)) or r) if (x in r) else r), range(3, int((int(600851475143 ** .5)+1)**0.5+1), 2), set([2] + range(3,int(600851475143 ** .5),2))) if 600851475143 % i == 0]) | |
| print 4, max([i * j for i in xrange(100, 1000) for j in range(100, 1000) if str(i * j) == str(i * j)[::-1]]) | |
| print 5, reduce(lambda a, b: a * b / sorted(set(map(lambda x: (x*int(a/x)==a) * x, xrange(1,a+1))).intersection(set(map(lambda x: (x*int(b/x)==b) * x, xrange(1,b+1)))))[-1], range(1, 21)) | |
| print 6, sum(range(101)) ** 2 - sum([i ** 2 for i in range(101)]) | |
| print 7, (lambda table: [[table.__setitem__(mult,False) for mult in range(i**2,1000000,i)] for i in range(2,int(1000000**0.5)+1) if table[ |