結果

問題 No.1220 yukipoker
ユーザー Jiro_tech15Jiro_tech15
提出日時 2020-03-26 18:46:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,145 bytes
コンパイル時間 949 ms
コンパイル使用メモリ 102,904 KB
実行使用メモリ 7,200 KB
最終ジャッジ日時 2024-05-01 21:16:00
合計ジャッジ時間 7,009 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

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