結果

問題 No.338 アンケート機能
コンテスト
ユーザー kichirb3
提出日時 2018-04-10 21:16:35
言語 Python3
(3.14.3 + numpy 2.4.2 + scipy 1.17.0)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 370 ms / 2,000 ms
コード長 756 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 891 ms
コンパイル使用メモリ 20,696 KB
実行使用メモリ 15,360 KB
最終ジャッジ日時 2026-03-13 16:12:37
合計ジャッジ時間 13,565 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# -*- coding: utf-8 -*-
"""
No.338 アンケート機能
https://yukicoder.me/problems/no/338

"""
import sys
from sys import stdin
input = stdin.readline


def solve(A, B):
    ans = [float('inf'), float('inf')]
    for a in range(1001):
        for b in range(1001):
            try:
                int_a = int((100.0 * a) / (a + b) + 0.5)
                int_b = int((100.0 * b) / (a + b) + 0.5)
                if int_a == A and int_b == B:
                    if a + b < ans[0] + ans[1]:
                        ans = [a, b]
            except ZeroDivisionError:
                pass
    return ans


def main(args):
    A, B = map(float, input().split())
    ans = solve(A, B)
    print(sum(ans))


if __name__ == '__main__':
    main(sys.argv[1:])
0