結果

問題 No.1220 yukipoker
ユーザー Jiro_tech15Jiro_tech15
提出日時 2020-03-26 17:55:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 274 ms / 2,000 ms
コード長 1,965 bytes
コンパイル時間 1,054 ms
コンパイル使用メモリ 98,972 KB
実行使用メモリ 5,404 KB
最終ジャッジ日時 2023-08-14 09:16:05
合計ジャッジ時間 4,279 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
5,060 KB
testcase_01 AC 6 ms
5,060 KB
testcase_02 AC 6 ms
5,100 KB
testcase_03 AC 6 ms
5,056 KB
testcase_04 AC 6 ms
5,164 KB
testcase_05 AC 6 ms
5,384 KB
testcase_06 AC 7 ms
5,176 KB
testcase_07 AC 6 ms
5,132 KB
testcase_08 AC 6 ms
5,232 KB
testcase_09 AC 6 ms
5,152 KB
testcase_10 AC 6 ms
5,156 KB
testcase_11 AC 122 ms
5,112 KB
testcase_12 AC 134 ms
5,404 KB
testcase_13 AC 262 ms
5,104 KB
testcase_14 AC 255 ms
5,220 KB
testcase_15 AC 164 ms
5,180 KB
testcase_16 AC 192 ms
5,108 KB
testcase_17 AC 111 ms
5,124 KB
testcase_18 AC 146 ms
5,056 KB
testcase_19 AC 264 ms
5,108 KB
testcase_20 AC 274 ms
5,160 KB
testcase_21 AC 6 ms
5,104 KB
testcase_22 AC 6 ms
5,124 KB
testcase_23 AC 7 ms
5,220 KB
testcase_24 AC 7 ms
5,224 KB
testcase_25 AC 6 ms
5,384 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;

//x * 10^y
//xは7桁
struct Num{
  ll x,y;

  Num(ll _x, ll _y){
    x = _x;
    y = _y;
  }

  Num operator*(Num obj){
    ll X = x * obj.x;
    ll Y = y + obj.y;
    while(X >= 1e7){
      X /= 10;
      Y++;
    }
    return {X, Y};
  }
};

Num npow(Num a, ll b){
  if(b==0) return Num(1, 0);
  else if(b%2==0){Num memo = npow(a, b/2); return memo*memo;}
  else return npow(a,b-1) * a;
}

vector<Num> kaijo_memo;
Num kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back({1, 0});
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * Num(kaijo_memo.size(), 0));
  return 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;
    Num S = kaijo(k) * kaijo(n-k+1) * npow({m,0}, k-1);
    Num F = kaijo(n);

    if(S.y < F.y || (S.y == F.y && S.x < F.x)){
      cout<<"Straight"<<endl;
    }else{
      cout<<"Flush"<<endl;
    }
  }

}
0