示例#1
0
def main(filename=None):
    if filename is None:
        if len(sys.argv) == 2:
            filename = sys.argv[1]
        else:
            print("Usage: runme.py input_file")
            return 1
    with open(filename, "r") as f:
        num_cases = read_int(f)
        for i, line in enumerate(f, 1):
            words = read_list_of_str(f)
            words.reverse()
            print("Case #" + str(i) + ": " + " ".join(words))
    return 0
示例#2
0
def main(filename=None):
    if filename is None:
        if len(sys.argv) == 2:
            filename = sys.argv[1]
        else:
            print("Usage: runme.py input_file")
            return 1
    with open(filename, "r") as f:
        num_test_cases = read_int(f)
        for i in range(1, num_test_cases + 1):
            name, num = read_list_of_str(f)
            n = int(num)
            print("Case #{0}:".format(i), end=" ")
            print(compute_n_value(name, n))
    return 0
示例#3
0
def main(filename=None):
    if filename is None:
        if len(sys.argv) == 2:
            filename = sys.argv[1]
        else:
            print("Usage: runme.py input_file")
            return 1
    with open(filename, "r") as f:
        num_test_cases = read_int(f)
        for i in range(1, num_test_cases + 1):
            name, num = read_list_of_str(f)
            n = int(num)
            print("Case #{0}:".format(i), end=" ")
            print(compute_n_value(name, n))
    return 0