Пример #1
0
def solve(fin, fout):
    L = codejam_io.read_simple(fin, str)
    S = map(solve_case, L)
    codejam_io.write_simple(fout, S)
Пример #2
0
def solve(infname, outfname):
    L= codejam_io.read_simple(infname, str)
    results = [solveA(Li) for Li in L]
    codejam_io.write_simple(outfname,results)
Пример #3
0
# competition io code from https://github.com/DarioFanucchi/CompetitionCode.git
import codejam_io


def addDigits(num, seen):
    for digit in str(num):
        if digit not in seen:
            seen.append(digit)
    return seen

def countSheep(N):
    seenNums = []
    for i in xrange(1, 100000):
        seenNums = addDigits(i*N, seenNums)
        if len(seenNums) == 10:
            break
    if i == 99999:
        return "INSOMNIA"
    else:
        return i*N

ans = []
for case in codejam_io.read_straight("A-large.in"):
    ans.append(countSheep(int(case)))

codejam_io.write_simple("A_large.out", ans)


Пример #4
0
def solve(fin, fout):
    L = codejam_io.read_f(fin, lambda x: [str] * x[0])
    S = map(solve_case, L)
    codejam_io.write_simple(fout, S)
Пример #5
0
def solve(fin, fout):
    L = codejam_io.read_f(fin, lambda x: [int] * (2 * x[0] - 1))
    S = map(solve_case, L)
    codejam_io.write_simple(fout, S)