結果
問題 |
No.437 cwwゲーム
|
ユーザー |
|
提出日時 | 2019-01-09 23:44:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 929 bytes |
コンパイル時間 | 762 ms |
コンパイル使用メモリ | 86,152 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 08:50:12 |
合計ジャッジ時間 | 1,985 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string> #include<iostream> #include<iostream> #include<cctype> #include<cstdio> #include<vector> #include<stack> #include<queue> #include <algorithm> #include<math.h> #include<set> #include<map> #include <sstream> #include<iomanip> #include <ctype.h> #include <fstream> #include <cassert> //#include <bits/stdc++.h> using namespace std; //#include<bits/stdc++.h> int d(string p) { int n = p.size(); int s = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { for (int k = j + 1; k < n; k++) { if (p[i] != '0'&&p[i] != p[j] && p[j] == p[k]) { int r = (p[i]) * 100 + (p[j] ) * 10 + p[k]-'0'*111; string x = p; x.erase(i, 1); x.erase(j-1, 1); x.erase(k-2, 1); s = max(s, d(x)+r); } } } } return s; } int main() { string p; cin >> p; cout << d(p) << endl; return 0; }