結果

問題 No.2551 2, 3, 5, 7 Game
ユーザー tonphytonphy
提出日時 2023-11-25 14:39:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 535 bytes
コンパイル時間 763 ms
コンパイル使用メモリ 65,336 KB
実行使用メモリ 814,720 KB
最終ジャッジ日時 2024-09-26 10:45:54
合計ジャッジ時間 4,650 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

int d[4]={2,3,5,7};

int dfs(int num,int stat,int n);

int main(){
  int t;
  cin>>t;
  for(int i=0;i<t;i++){
    int n;
    cin>>n;
    if(dfs(1,1,n)==1){
      cout<<"sepa"<<endl;
    }else{
      cout<<"ryota"<<endl;
    }
  }
  return(0);
}

int dfs(int num,int stat,int n){
  if(num>=n){
    return(stat);
  }

  bool success=false;
  for(int i=0;i<4;i++){
    if(dfs(num*d[i],stat^1,n)==stat){
      success=true;
    }
  }
  if(success){
    return(stat);
  }
  return(stat^1);
}
	     
0