結果

問題 No.338 アンケート機能
ユーザー nanaenanae
提出日時 2017-02-16 17:34:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 678 bytes
コンパイル時間 67 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 7,956 KB
最終ジャッジ日時 2023-08-28 17:39:37
合計ジャッジ時間 2,665 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
7,832 KB
testcase_01 AC 50 ms
7,752 KB
testcase_02 AC 48 ms
7,832 KB
testcase_03 AC 48 ms
7,772 KB
testcase_04 AC 15 ms
7,828 KB
testcase_05 AC 48 ms
7,908 KB
testcase_06 AC 14 ms
7,896 KB
testcase_07 AC 48 ms
7,772 KB
testcase_08 AC 48 ms
7,772 KB
testcase_09 AC 48 ms
7,828 KB
testcase_10 AC 51 ms
7,772 KB
testcase_11 AC 49 ms
7,832 KB
testcase_12 AC 49 ms
7,752 KB
testcase_13 AC 48 ms
7,832 KB
testcase_14 AC 48 ms
7,748 KB
testcase_15 AC 48 ms
7,824 KB
testcase_16 AC 48 ms
7,764 KB
testcase_17 AC 48 ms
7,908 KB
testcase_18 AC 48 ms
7,832 KB
testcase_19 AC 49 ms
7,888 KB
testcase_20 AC 49 ms
7,832 KB
testcase_21 AC 48 ms
7,828 KB
testcase_22 AC 48 ms
7,956 KB
testcase_23 AC 49 ms
7,904 KB
testcase_24 AC 48 ms
7,776 KB
testcase_25 AC 48 ms
7,856 KB
testcase_26 AC 48 ms
7,852 KB
testcase_27 AC 48 ms
7,824 KB
testcase_28 AC 48 ms
7,776 KB
testcase_29 AC 48 ms
7,900 KB
testcase_30 AC 48 ms
7,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    A, B = map(int, input().split())

    if A == 0 or B == 0:
        print(1)
        return

    ans = float('inf')

    for a in range(1, 200 + 1):
        for b in range(1, 200 + 1):
            if calc_per(a, b) == (A, B):
                ans = min(ans, a + b)

    assert ans != float('inf')
    
    print(ans)

def calc_per(a, b):
    return myround(100*a/(a+b)), myround(100*b/(a+b))

def myround(x):
    return int((2*x + 1)//2)

if __name__ == '__main__':
    solve()
0