コード例 #1
0
def test_solve_it_19_items():
    # 19 item problem
    input_text = "19 31181\n1945 4990\n321 1142\n2945 7390\n4136 10372\n1107 3114\n1022 2744\n1101 3102\n2890 7280\n962 2624\n1060 3020\n805 2310\n689 2078\n1513 3926\n3878 9656\n13504 32708\n1865 4830\n667 2034\n1833 4766\n16553 40006"

    best_value = 12248
    optimal = 1
    best_choice = [0,0,1,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0]
    output_data = str(best_value) + ' ' + str(optimal) + '\n'
    output_data += str(best_choice)
    result = solve_it(input_text)
    assert result == output_data
コード例 #2
0
def test_solve_it_4_items():
    # 4 item problem
    input_text = "4 11\n8 4\n10 5\n15 8\n4 3\n"
    
    best_value = 19
    optimal = 1
    best_choice = [0,0,1,1]
    output_data = str(best_value) + ' ' + str(optimal) + '\n'
    output_data += str(best_choice)
    
    result = solve_it(input_text)
    assert result == output_data
コード例 #3
0
ファイル: algo_v2.py プロジェクト: atthom/HashCodeKCDQ
def algo(cache_size, nb_cache, endpoints, video_sizes):
    tab_of_tab_request_servers = []
    return solve_it(tab_of_tab_request_servers, cache_size)