結果

問題 No.2551 2, 3, 5, 7 Game
ユーザー dyktr_06dyktr_06
提出日時 2023-11-07 13:06:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 661 bytes
コンパイル時間 2,037 ms
コンパイル使用メモリ 208,552 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-11-14 12:50:11
合計ジャッジ時間 2,957 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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 = 0;
    res = max(res, calc(now * 2));
    res = max(res, calc(now * 3));
    res = max(res, calc(now * 5));
    res = max(res, 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);

    cin >> n;

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