結果

問題 No.1220 yukipoker
ユーザー 👑 obakyanobakyan
提出日時 2021-05-27 18:28:27
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 726 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 04:34:47
合計ジャッジ時間 2,698 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,248 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 31 ms
5,376 KB
testcase_12 AC 32 ms
5,376 KB
testcase_13 AC 59 ms
5,376 KB
testcase_14 AC 63 ms
5,376 KB
testcase_15 AC 40 ms
5,376 KB
testcase_16 AC 44 ms
5,376 KB
testcase_17 AC 26 ms
5,376 KB
testcase_18 AC 35 ms
5,376 KB
testcase_19 AC 62 ms
5,376 KB
testcase_20 AC 62 ms
5,376 KB
testcase_21 AC 4 ms
5,376 KB
testcase_22 AC 4 ms
5,376 KB
testcase_23 AC 4 ms
5,376 KB
testcase_24 AC 4 ms
5,376 KB
testcase_25 AC 3 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local mlg = math.log
local q = io.read("*n")

local lgsum = {0}
for i = 2, 100010 do
  lgsum[i] = lgsum[i - 1] + mlg(i)
end
local function getLogSum(i)
  if i == 0 then return 0
  else return lgsum[i]
  end
end

for iq = 1, q do
  local n, m, k = io.read("*n", "*n", "*n")
  if n < k then
    print("Flush")
  else
    --[[
    local f = 1
    for i = 1, k - 1 do
      f = f * (n - i) / (n * m - i)
    end
    local s = 1
    for i = 1, k - 1 do
      s = s * (m * (n - i)) / (n * m - i)
    end
    s = s * (n + 1 - k) / getComb(n, k)
    print(f, s)
    ]]
    local sf = (k - 1) * mlg(m) + mlg(n + 1 - k)
             + getLogSum(k) + getLogSum(n - k) - getLogSum(n)
    print(sf < 0 and "Straight" or "Flush")
  end
end
0