結果

問題 No.338 アンケート機能
コンテスト
ユーザー kichirb3
提出日時 2018-03-25 23:48:32
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 746 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 350 ms
コンパイル使用メモリ 20,956 KB
実行使用メモリ 15,488 KB
最終ジャッジ日時 2026-03-11 13:29:17
合計ジャッジ時間 4,556 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 9
権限があれば一括ダウンロードができます

ソースコード

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 = [A, B]
    for a in range(int(A+B+1)):
        for b in range(int(A+B+1)):
            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