結果

問題 No.2551 2, 3, 5, 7 Game
ユーザー dyktr_06
提出日時 2023-11-14 12:50:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 673 bytes
コンパイル時間 2,149 ms
コンパイル使用メモリ 199,268 KB
最終ジャッジ日時 2025-02-17 21:58:56
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 TLE * 1 -- * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

long long n;
map<long long, long long> dp;

int calc(long long now){
    if(dp.count(now)){
        return dp[now];
    }
    if(now >= n){
        return dp[now] = 0;
    }
    int res = max({calc(now * 2), calc(now * 3), calc(now * 5), calc(now * 7)});
    if(res == 0){
        return dp[now] = 1;
    }else{
        return dp[now] = 0;
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t; cin >> t;

    while(t--){
        cin >> n;

        if(calc(1) == 0){
            cout << "sepa" << endl;
        }else{
            cout << "ryota" << endl;
        }
        dp.clear();
    }
}
0