結果

問題 No.1220 yukipoker
ユーザー f_stshf_stsh
提出日時 2020-09-06 10:34:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 192 ms / 2,000 ms
コード長 909 bytes
コンパイル時間 2,234 ms
コンパイル使用メモリ 164,836 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-19 13:34:17
合計ジャッジ時間 5,260 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,376 KB
testcase_01 AC 4 ms
4,380 KB
testcase_02 AC 3 ms
4,384 KB
testcase_03 AC 3 ms
4,384 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 3 ms
4,384 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 3 ms
4,384 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 84 ms
4,376 KB
testcase_12 AC 89 ms
4,380 KB
testcase_13 AC 178 ms
4,380 KB
testcase_14 AC 180 ms
4,384 KB
testcase_15 AC 111 ms
4,380 KB
testcase_16 AC 131 ms
4,380 KB
testcase_17 AC 75 ms
4,380 KB
testcase_18 AC 96 ms
4,376 KB
testcase_19 AC 183 ms
4,380 KB
testcase_20 AC 192 ms
4,376 KB
testcase_21 AC 4 ms
4,380 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 4 ms
4,376 KB
testcase_24 AC 4 ms
4,380 KB
testcase_25 AC 3 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 100005;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
vector<double> logSum(MAX);
/* function */
void init() {
    for (int i = 1; i < MAX; i++)
        logSum[i] = logSum[i - 1] + log(i);
}
void solve() {
    int N, M, K;
    cin >> N >> M >> K;
    // Flush: m * nCk
    // Straight: (n - k + 1) * (m ** k)
    // これを対数をとって比べる
    // log(n!) = \sum_{i=1}^{n} log(i)
    double l = logSum[N];
    double r = logSum[N - K + 1] + logSum[K] + log(M) * (K - 1);
    cout << (l < r ? "Flush" : "Straight") << '\n';

}
/* main */
int main(){
    init();
    int Q;
    cin >> Q;
    for (int i = 0; i < Q; i++) {
        solve();
    }
}
0