結果

問題 No.1220 yukipoker
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-03-19 14:22:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 560 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 93,312 KB
最終ジャッジ日時 2024-04-29 07:29:35
合計ジャッジ時間 5,470 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
65,920 KB
testcase_01 AC 53 ms
66,048 KB
testcase_02 AC 53 ms
65,792 KB
testcase_03 AC 55 ms
65,792 KB
testcase_04 AC 54 ms
65,920 KB
testcase_05 AC 54 ms
65,920 KB
testcase_06 AC 54 ms
66,048 KB
testcase_07 AC 53 ms
65,664 KB
testcase_08 AC 54 ms
65,536 KB
testcase_09 AC 55 ms
65,920 KB
testcase_10 AC 53 ms
65,920 KB
testcase_11 AC 148 ms
87,424 KB
testcase_12 AC 154 ms
87,936 KB
testcase_13 AC 206 ms
93,184 KB
testcase_14 AC 199 ms
93,184 KB
testcase_15 AC 164 ms
89,344 KB
testcase_16 AC 174 ms
90,368 KB
testcase_17 AC 146 ms
86,656 KB
testcase_18 AC 160 ms
88,448 KB
testcase_19 AC 213 ms
93,312 KB
testcase_20 AC 207 ms
93,184 KB
testcase_21 AC 54 ms
66,432 KB
testcase_22 AC 54 ms
66,176 KB
testcase_23 AC 54 ms
66,688 KB
testcase_24 AC 56 ms
66,304 KB
testcase_25 AC 55 ms
66,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import log
q=int(input())
nmk=[list(map(int,input().split())) for _ in range(q)]
lary=[0]
for i in range(1,10**5+3):
  lary.append(lary[-1]+log(i))
# lary[k]:log(1)+log(2)+...+log(k)
for n,m,k in nmk:
  # Flush
  # m*cmb(n,k)通り
  # Straight
  # (n+1-k)*m^k通り
  # max(S/F,F/S)>=2という条件
  # log((n+1-k)*m^k)=log(n+1-k)+k*log(m)
  s=log(n+1-k)+k*log(m)
  # log(m*cmb(n,k))=log(m)+log(cmb(n,k))
  # log(cmb(n,k))=log(n!)-log(k!)-log((n-k)!)
  f=log(m)+lary[n]-lary[k]-lary[n-k]
  if f>s:
    print('Straight')
  else:
    print('Flush')
0