結果
| 問題 |
No.437 cwwゲーム
|
| コンテスト | |
| ユーザー |
treeone
|
| 提出日時 | 2016-10-28 22:31:30 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 998 bytes |
| コンパイル時間 | 1,266 ms |
| コンパイル使用メモリ | 159,620 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-24 06:51:22 |
| 合計ジャッジ時間 | 2,485 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 WA * 1 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define first first
#define second se
using namespace std;
typedef pair<int, int> P;
typedef vector<int> vi;
string s;
int ans = 0;
void dfs(string t, int now){
int l = t.size();
rep(i, 0, l){
rep(j, i + 1, l){
rep(k, j + 1, l){
if((t[i] != t[j]) && (t[j] == t[k])){
int tmp = (t[i] - '0') * 100 + (t[j] - '0') * 10 + t[k] - '0';
string r;
rep(p, 0, l){
if(p == i || p == j || p == k) continue;
r += t[p];
}
dfs(r, now + tmp);
ans = max(ans, now + tmp);
}
}
}
}
return;
}
signed main(){
cin >> s;
dfs(s, 0);
o(ans);
}
treeone