結果

問題 No.1220 yukipoker
ユーザー donuthole
提出日時 2020-09-04 22:34:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,306 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 222,104 KB
最終ジャッジ日時 2024-11-26 15:49:01
合計ジャッジ時間 34,028 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 1 WA * 14 TLE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
import collections
import bisect
import itertools
import decimal
import copy

# import numpy as np

# sys.setrecursionlimit(10 ** 6)
INF = 10 ** 20
# MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

# nCrの左項にはn以外も来るバージョン、1!~(n-1)!を保持
def prepare(n, MOD):
    f = 1
    factorials = [1]
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    inv = pow(f, MOD - 2, MOD)
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
    return factorials, invs


def main():
    # 使い方
    lim = 10 ** 5 + 1
    MOD = 2147483647
    facts, invs = prepare(lim, MOD)

    q = ni()
    for _ in range(q):
        a, b, c = ns()
        straight = pow(b, c) * (a - c + 1)
        flash = a * (facts[b] * invs[c] * invs[b - c])
        if straight > flash:
            print("Flush")
        else:
            print("Straight")


if __name__ == '__main__':
    main()
0