Esempio n. 1
0
def everything():
    testCases = io_helper.get_input()
    numCases = testCases[0]
    testCases.pop(0)

    io_helper.prep_output()

    for i in xrange(0, len(testCases)):
        io_helper.write_output(i, b(testCases[i]))
Esempio n. 2
0
def everything():
	lines = io_helper.get_input()
	lines.pop(0)
	testCases = []
	while len(lines) > 0:
		num_word_pairs = int(lines[0])
		lines.pop(0)
		case = []
		for i in xrange(0, num_word_pairs):
			case.append(lines[i].strip())
		for _ in xrange(0, num_word_pairs):
			lines.pop(0)
		testCases.append(case)
Esempio n. 3
0
def fractiles():
	testCases = io_helper.get_input()
	numTestCases = testCases[0]
	testCases.remove(numTestCases)
	output_filename = 'output.txt'

	io_helper.prep_output()

	for i in xrange(0, len(testCases)):
		testCase = testCases[i].split(' ')
		spotsToCheck = findSpotsToCheck(int(testCase[0]), int(testCase[1]), int(testCase[2]))

		io_helper.write_output(i, spotsToCheck)
Esempio n. 4
0
def b():
    testCases = io_helper.get_input()
    numTestCases = testCases[0]
    testCases.pop(0)

    squads = []
    squadNumber = -1
    for str in testCases:
        if len(str.split()) == 1:
            squadNumber += 1
            squads.append([])
        else:
            squads[squadNumber].append(str)
    return squads
Esempio n. 5
0
import io_helper


def a(str):
    new_str = ""
    for i in xrange(0, len(str)):
        char = str[i]
        if i == 0:
            new_str = new_str + str[i]
        else:
            if str[i] < new_str[0]:
                new_str = new_str + str[i]
            else:
                new_str = str[i] + new_str
    return new_str.strip()


testCases = io_helper.get_input()
numCases = testCases[0]
testCases.pop(0)

io_helper.prep_output()

for i in xrange(0, len(testCases)):
    io_helper.write_output(i, a(testCases[i]))
Esempio n. 6
0
def play_game():
    knights, weapons = setup()
    for knight, direction in get_input():
        process_knight(knight, direction, knights, weapons)
    make_output(knights, weapons)