def execute_test_case():
    matrix_size = prompt_single_numeric_input(1, 20)
    matrix_rows = []
    for i in range(matrix_size):
        matrix_rows.append(prompt_multiple_numeric_input(matrix_size, [(1, 1000)]))

    counter = 0
    for row1 in range(matrix_size):
        for column1 in range(matrix_size):
            matrix_entry = matrix_rows[row1][column1]
            for row2 in range(row1, matrix_size):
                for column2 in range(column1, matrix_size):
                    compare_entry = matrix_rows[row2][column2]
                    if compare_entry < matrix_entry:
                        counter += 1
    print(counter)
Esempio n. 2
0
        index = get_next_rotating_index(index, dec_values)
        cyclic_shift_counter += 1
    return cyclic_shift_counter


def execute_test_case(case_number: int) -> int:
    logger.info(f"Starting test case ${case_number + 1}")
    string_len, repeats = prompt_multiple_numeric_input(
        2, [(1, 10**5), (1, 10**9)])
    binary_string = input()
    validate_binary_string(binary_string, string_len)
    dec_values = []
    max_value = 0
    shifted_string = binary_string
    shifts = []
    for j in range(string_len):
        shifts.append(shifted_string)
        dec_value = int(shifted_string, 2)
        max_value = max(max_value, dec_value)
        dec_values.append(dec_value)
        shifted_string = left_shift_string(shifted_string)

    return count_cyclic_shifts(repeats, dec_values, max_value)


if __name__ == "__main__":
    logger.info("Cyclic shift startet")
    test_case_count = prompt_single_numeric_input(1, 10**3)
    process_and_print_test_case_results(test_case_count, execute_test_case)
    logger.info("Test case finished")
Esempio n. 3
0
def run():
    if __name__ == "__main__":
        test_case_count = prompt_single_numeric_input(1, 100000)
        process_and_print_test_case_results(test_case_count, test_case2)
Esempio n. 4
0
def test_case2(_: int):
    character_count = prompt_single_numeric_input(0, 1000000009)

    return get_string_number2(character_count)
Esempio n. 5
0
def test_case(_: int) -> int:
    array_size = prompt_single_numeric_input(1, 10**5)
    array = prompt_multiple_numeric_input(array_size, [(0, 10**9)])
    permutations = get_permutations(array)

    return get_minimum_of_bool_expression(permutations)