結果

問題 No.374 コイン
ユーザー lam6er
提出日時 2025-03-31 17:38:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 761 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 82,484 KB
実行使用メモリ 54,308 KB
最終ジャッジ日時 2025-03-31 17:39:22
合計ジャッジ時間 2,601 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

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

def max_coins_on_perimeter(R, B_val):
    if B_val == 0:
        return 0
    if B_val > R:
        return 0
    low = 1
    high = 10**18
    ans = 0
    while low <= high:
        mid = (low + high) // 2
        theta = math.pi / mid
        if R * math.sin(theta) >= B_val:
            ans = mid
            low = mid + 1
        else:
            high = mid - 1
    return ans

if B > A:
    print("K")
elif A < 3 * B:
    print("S")
else:
    R = A - B
    # Calculate max coins around with center
    n = max_coins_on_perimeter(R, B)
    N1 = 1 + n
    # Calculate max coins around without center
    m = max_coins_on_perimeter(R, B)
    N2 = m
    maxN = max(N1, N2)
    print("S" if maxN % 2 == 1 else "K")
0