結果

問題 No.2551 2, 3, 5, 7 Game
ユーザー dyktr_06dyktr_06
提出日時 2023-11-14 12:50:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 673 bytes
コンパイル時間 2,580 ms
コンパイル使用メモリ 207,360 KB
実行使用メモリ 12,928 KB
最終ジャッジ日時 2024-09-26 07:19:09
合計ジャッジ時間 13,385 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,046 ms
12,928 KB
testcase_01 AC 1,180 ms
6,656 KB
testcase_02 AC 1,063 ms
6,528 KB
testcase_03 AC 1,077 ms
6,528 KB
testcase_04 AC 1,093 ms
6,656 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
権限があれば一括ダウンロードができます

ソースコード

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