結果

問題 No.338 アンケート機能
ユーザー kichirb3
提出日時 2018-03-25 23:48:32
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 746 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-06-25 06:22:50
合計ジャッジ時間 2,408 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- 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