コード例 #1
0
def read_int_1d():
    """
    Read from sys.stdin and return an array of integers. An integer at the beginning of sys.stdin defines the array's
    length.
    """
    count = stdio.read_int()
    a = create_1d(count, None)
    for i in range(count):
        a[i] = stdio.read_int()
    return a
コード例 #2
0
def read_int_2d():
    """
    Read from sys.stdin and return a two-dimensional array of integers. Two integers at the beginning of sys.stdin
    define the array's dimensions.
    """
    row_count = stdio.read_int()
    column_count = stdio.read_int()
    a = create_2d(row_count, column_count, 0)
    for row in range(row_count):
        for col in range(column_count):
            a[row][col] = stdio.read_int()
    return a