結果

問題 No.1220 yukipoker
ユーザー Jiro_tech15Jiro_tech15
提出日時 2020-03-26 18:50:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 226 ms / 2,000 ms
コード長 2,164 bytes
コンパイル時間 985 ms
コンパイル使用メモリ 104,148 KB
実行使用メモリ 6,896 KB
最終ジャッジ日時 2024-05-01 21:51:21
合計ジャッジ時間 3,872 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
6,372 KB
testcase_01 AC 8 ms
6,364 KB
testcase_02 AC 8 ms
6,896 KB
testcase_03 AC 8 ms
6,420 KB
testcase_04 AC 9 ms
6,076 KB
testcase_05 AC 8 ms
6,816 KB
testcase_06 AC 9 ms
6,340 KB
testcase_07 AC 9 ms
6,436 KB
testcase_08 AC 8 ms
6,332 KB
testcase_09 AC 8 ms
6,436 KB
testcase_10 AC 9 ms
6,344 KB
testcase_11 AC 101 ms
6,236 KB
testcase_12 AC 106 ms
6,320 KB
testcase_13 AC 203 ms
6,336 KB
testcase_14 AC 199 ms
6,720 KB
testcase_15 AC 135 ms
6,464 KB
testcase_16 AC 153 ms
6,312 KB
testcase_17 AC 92 ms
6,336 KB
testcase_18 AC 119 ms
6,836 KB
testcase_19 AC 224 ms
6,780 KB
testcase_20 AC 226 ms
6,284 KB
testcase_21 AC 10 ms
6,348 KB
testcase_22 AC 9 ms
6,532 KB
testcase_23 AC 8 ms
6,316 KB
testcase_24 AC 9 ms
6,240 KB
testcase_25 AC 9 ms
6,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
#include <cassert>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

vector<double> kaijo_memo;
double kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back((double)0);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] + log(kaijo_memo.size()));
  return kaijo_memo[n];
}

vector<long double> L_kaijo_memo;
long double L_kaijo(ll n){
  if(L_kaijo_memo.size() > n) return L_kaijo_memo[n];
  if(L_kaijo_memo.size() == 0) L_kaijo_memo.push_back((long double)0);
  while(L_kaijo_memo.size() <= n) L_kaijo_memo.push_back(L_kaijo_memo[L_kaijo_memo.size()-1] + log((long double)L_kaijo_memo.size()));
  return L_kaijo_memo[n];
}


int main(void){
  //Flush
  //M * N! / (N-K)!

  //Straight
  //(N-K+1) * K! * M^K

  //S/F
  //K! * (N-K+1)! * M^(k-1) / N!

  ll q;cin>>q;
  rep(i,q){
    ll n,m,k;cin>>n>>m>>k;
    double S = kaijo(k) + kaijo(n-k+1) + (k-1) * log(m);
    double F = kaijo(n);
    long double LS = L_kaijo(k) + L_kaijo(n-k+1) + (k-1) * log((long double)m);
    long double LF = L_kaijo(n);
    if(S < F){
      cout<<"Straight"<<endl;
    }else{
      cout<<"Flush"<<endl;
    }
    //cout<<S<<" "<<F<<endl;

    //assert(abs(LS - S) >= 1e-7);
    //assert(abs(LF - F) >= 1e-7);
    assert(abs(F - S) >= log(2));
  }

}
0