結果

問題 No.338 アンケート機能
ユーザー lam6er
提出日時 2025-03-26 15:45:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 862 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 82,632 KB
実行使用メモリ 53,828 KB
最終ジャッジ日時 2025-03-26 15:45:43
合計ジャッジ時間 2,294 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

A, B = map(int, input().split())

n = 1
while True:
    # Calculate A's a range
    a_min_A = math.ceil(( (2*A - 1) * n ) / 200.0 )
    a_max_A = math.floor( ( (2*A + 1) * n ) / 200.0 - 1e-9 )
    
    # Calculate B's a range
    num_b_min = (2*(100 - B) - 1) * n
    b_min = math.floor(num_b_min / 200.0) + 1
    num_b_max = (2*(100 - B) + 1) * n
    b_max = math.floor(num_b_max / 200.0)
    
    # Find overlapping range
    lower = max(a_min_A, b_min)
    upper = min(a_max_A, b_max)
    
    if lower > upper:
        n += 1
        continue
    
    # Adjust to a valid range (0 <= a <= n)
    if lower < 0:
        lower = 0
    if upper > n:
        upper = n
    if lower > upper:
        n += 1
        continue
    
    # Check if there's any integer in [lower, upper]
    if lower <= upper:
        print(n)
        break
    
    n += 1
0