結果
問題 | No.1220 yukipoker |
ユーザー |
|
提出日時 | 2025-03-03 00:58:01 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,364 bytes |
コンパイル時間 | 853 ms |
コンパイル使用メモリ | 82,292 KB |
実行使用メモリ | 114,740 KB |
最終ジャッジ日時 | 2025-03-03 00:58:05 |
合計ジャッジ時間 | 3,849 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 WA * 15 |
ソースコード
import mathimport sysdef main():input = sys.stdin.read().split()Q = int(input[0])idx = 1for _ in range(Q):N = int(input[idx])M = int(input[idx+1])K = int(input[idx+2])idx +=3if K == 1:print("Flush" if 1 < 1 else "Straight") # Unreachable due to problem constraintscontinuea = N - K + 2# Compute sum1: sum_{x=a}^N ln(x) ≈ integral from a-1 to N of ln(x) dxif a > N:sum1 = 0.0else:x_upper = N + 1integral_upper = x_upper * math.log(x_upper) - x_upperx_lower = a - 1if x_lower < 1:x_lower = 1integral_lower = 0.0else:integral_lower = x_lower * math.log(x_lower) - x_lowersum1 = integral_upper - integral_lower# Compute sum2: ln(K!) using Stirling's approximationif K == 0:sum2 = 0.0else:sum2 = K * math.log(K) - K + 0.5 * math.log(2 * math.pi * K)left_part = sum1 - sum2threshold = left_part / (K - 1)ln_M = math.log(M)if ln_M > threshold:print("Flush")else:print("Straight")if __name__ == "__main__":main()