結果

問題 No.338 アンケート機能
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-03-13 20:45:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 748 ms / 2,000 ms
コード長 794 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-04-25 15:57:47
合計ジャッジ時間 19,633 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 570 ms
11,264 KB
testcase_01 AC 568 ms
11,264 KB
testcase_02 AC 558 ms
11,264 KB
testcase_03 AC 576 ms
11,264 KB
testcase_04 AC 559 ms
11,264 KB
testcase_05 AC 575 ms
11,392 KB
testcase_06 AC 540 ms
11,264 KB
testcase_07 AC 551 ms
11,264 KB
testcase_08 AC 579 ms
11,264 KB
testcase_09 AC 567 ms
11,264 KB
testcase_10 AC 550 ms
11,264 KB
testcase_11 AC 748 ms
11,264 KB
testcase_12 AC 721 ms
11,264 KB
testcase_13 AC 584 ms
11,264 KB
testcase_14 AC 554 ms
11,264 KB
testcase_15 AC 540 ms
11,392 KB
testcase_16 AC 555 ms
11,392 KB
testcase_17 AC 544 ms
11,264 KB
testcase_18 AC 565 ms
11,264 KB
testcase_19 AC 580 ms
11,264 KB
testcase_20 AC 558 ms
11,264 KB
testcase_21 AC 571 ms
11,264 KB
testcase_22 AC 595 ms
11,264 KB
testcase_23 AC 580 ms
11,264 KB
testcase_24 AC 530 ms
11,264 KB
testcase_25 AC 534 ms
11,264 KB
testcase_26 AC 563 ms
11,392 KB
testcase_27 AC 556 ms
11,392 KB
testcase_28 AC 578 ms
11,264 KB
testcase_29 AC 571 ms
11,264 KB
testcase_30 AC 559 ms
11,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import decimal
import itertools


MAX_CAND = 500


def solve(a0, b0):
    answer = None
    with decimal.localcontext() as context:
        context.rounding = decimal.ROUND_HALF_UP
        answer = decimal.Decimal("Inf")
        gen = (context.create_decimal(i) for i in range(MAX_CAND))
        for a, b in itertools.product(gen, repeat=2):
            if a == b == 0:
                continue
            cond_a = context.quantize(100 * a / (a + b), 0) == a0
            cond_b = context.quantize(100 * b / (a + b), 0) == b0
            if cond_a and cond_b:
                answer = min(answer, int(a + b))
    return answer


def main():
    a0, b0 = map(int, input().split())
    print(solve(a0, b0))


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