結果

問題 No.437 cwwゲーム
ユーザー ebicochinealebicochineal
提出日時 2016-10-29 00:36:45
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,942 bytes
コンパイル時間 748 ms
コンパイル使用メモリ 75,884 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-20 13:02:31
合計ジャッジ時間 1,941 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 WA -
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 1 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 2 ms
5,376 KB
testcase_39 AC 2 ms
5,376 KB
testcase_40 AC 1 ms
5,376 KB
testcase_41 AC 2 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
testcase_43 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
typedef long long int LLI;
typedef unsigned long long int ULLI;
using namespace std;

string replace5126(string str, string old_s, string new_s) {
    int i;
    if (old_s == "") { return str; }
    while ((i = str.find(old_s)) > -1) { str.replace(i, old_s.size(), new_s); }
    return str;
}

int count5126(string str, string a) {
    int i = 0, cnt = 0;
    if (a == "") { return -1; }
    while ((i = str.find(a, i)) > -1) { ++cnt; i += a.size(); }
    return cnt;
}

vector<string> split5126(string str, string sep) {
    int s = 0, p = 0;
    vector<string> v;
    if (sep == "") {
        v.push_back(str);
        return v;
    }
    while ((p = str.find(sep, s)) > -1) {
        v.push_back(str.substr(s, p - s));
        s = p + sep.size();
    }
    v.push_back(str.substr(s, str.size()));
    return v;
}

string slice5126(string str, int a, int b) {
    int s = a < 0 ? str.size() + a : a;
    int e = b < 0 ? str.size() + b : b;
    e = b == 0 ? str.size() : e;
    return str.substr(s, (s > e ? s : e) - s);
}

string strdel(string s, int t) {
    string r = "";
    string ts = to_string(t);
    int c = 0;
    for (auto i : s) {
        if (c < 3 && i == ts[c]) {
            ++c;
        } else {
            r += i;
        }
    }
    return c < 3 ? "e" : r;
}


LLI solve(string s, LLI n) {
    LLI r = n;
    string a;
    if (s.size() < 3) { return r; }
    for (int x = 1; x < 10; ++x) {
        for (int y = 0; y < 10; ++y) {
            a = strdel(s, (x * 100 + y * 10 + y));
            if (x != y && a != "e") {
                r = max(r, solve(a, n + (x * 100 + y * 10 + y)));
            }
        }
        
    }
    return r;
}

int main() {
    LLI n;
    cin >> n;
    cout << solve(to_string(n), 0) << endl;
    return 0;
}
0