結果

問題 No.2551 2, 3, 5, 7 Game
コンテスト
ユーザー tonphy
提出日時 2023-11-25 14:42:32
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
MLE  
実行時間 -
コード長 515 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 368 ms
コンパイル使用メモリ 74,624 KB
実行使用メモリ 1,308,416 KB
最終ジャッジ日時 2026-04-13 13:37:16
合計ジャッジ時間 3,447 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other MLE * 2 -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<iostream>
using namespace std;

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

int dfs(int num,int stat);

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

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

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