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
import subprocess, timeit | |
def construct_command(type, algorithm, start=None, ends=None, moves_set=None): | |
""" | |
type: "search" | "game" | |
algorithm: [1..6] | [1..2] | |
moves_set: [[(4,1), (4,2), ...],] | None | |
start: (1,1) | None | |
ends: [(1,2), (2,1), ...] | None |
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
// 2015 Sitting 1 - Rabbit.java | |
public class Rabbit { | |
private Integer[][] r; // Array of past sequences | |
private int n; // Number of sequences in r | |
public Rabbit(int n) { | |
this.n = n; | |
r = new Integer[n][]; |
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
lookUp :: Char -> [(Char, Char)] -> Char | |
lookUp c [] = c | |
lookUp c charset = if not (null y) then head y else c | |
where y = [b | (a,b) <- charset, a == c] |
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
contains phrase word = word `elem` [take (length word) (drop x phrase) | x <- [0..(length phrase - length word)]] | |
contains phrase word = True `elem` [word `isPrefixOf` drop n phrase | n <- [0..(length phrase - length word)]] |
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
user www-data; | |
worker_processes 4; | |
pid /run/nginx.pid; | |
events { | |
worker_connections 768; | |
# multi_accept on; | |
} | |
http { |