結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
6,628 KB
testcase_01 AC 8 ms
6,360 KB
testcase_02 AC 9 ms
6,760 KB
testcase_03 AC 8 ms
6,300 KB
testcase_04 AC 8 ms
6,204 KB
testcase_05 AC 9 ms
6,948 KB
testcase_06 AC 9 ms
6,208 KB
testcase_07 AC 9 ms
6,560 KB
testcase_08 AC 9 ms
6,328 KB
testcase_09 AC 8 ms
6,468 KB
testcase_10 AC 9 ms
6,336 KB
testcase_11 AC 99 ms
6,364 KB
testcase_12 AC 106 ms
6,224 KB
testcase_13 AC 201 ms
6,204 KB
testcase_14 AC 199 ms
6,848 KB
testcase_15 AC 131 ms
6,208 KB
testcase_16 AC 143 ms
6,436 KB
testcase_17 AC 88 ms
6,208 KB
testcase_18 AC 116 ms
6,836 KB
testcase_19 AC 210 ms
6,808 KB
testcase_20 AC 207 ms
6,160 KB
testcase_21 AC 9 ms
6,348 KB
testcase_22 AC 9 ms
6,400 KB
testcase_23 AC 8 ms
6,324 KB
testcase_24 AC 8 ms
6,236 KB
testcase_25 AC 9 ms
6,484 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>
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