結果
| 問題 |
No.338 アンケート機能
|
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2016-03-13 20:45:32 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 741 ms / 2,000 ms |
| コード長 | 794 bytes |
| コンパイル時間 | 192 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 11,392 KB |
| 最終ジャッジ日時 | 2024-11-08 03:06:17 |
| 合計ジャッジ時間 | 21,069 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#!/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()
はむ吉🐹