結果

問題 No.1220 yukipoker
ユーザー merom686
提出日時 2020-09-04 23:08:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 747 bytes
コンパイル時間 911 ms
コンパイル使用メモリ 90,788 KB
最終ジャッジ日時 2025-01-14 06:23:50
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

double fact(ll x) {
    if (x <= 1) return 0;
    double t = x;
    return t * log(t) - t + 0.5 * log(2 * acos(-1) * t);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int q;
    cin >> q;

    while (q--) {
        int n, m, k;
        cin >> n >> m >> k;

        double f = fact(n - 1) - fact(n - 1 - (k - 1)) - (fact((ll)n * m - 1) - fact((ll)n * m - 1 - (k - 1)));
        double s = log(m) * k - (fact((ll)n * m) - fact((ll)n * m - k)) + fact(k) + log(n - k + 1);

        cout << (f < s ? "Flush" : "Straight") << '\n';
    }

    return 0;
}
0