結果

問題 No.437 cwwゲーム
ユーザー moyashi_senpaimoyashi_senpai
提出日時 2016-10-28 22:37:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,224 bytes
コンパイル時間 851 ms
コンパイル使用メモリ 97,992 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-24 06:51:31
合計ジャッジ時間 1,992 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define POWT(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODI 10000
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

int func(string str) {
	int ret = 0;
	int len = str.length();

	REP(i, len) {
		rep(j, i + 1, len) {
			rep(k, j + 1, len) {
				if ((str[i] != str[j] )&& (str[j] == str[k])) {
					string ns(str);
					ns.erase(ns.begin() + k);
					ns.erase(ns.begin() + j);
					ns.erase(ns.begin() + i);
					int can = (str[i] - '0') * 100 + (str[j] - '0') * 10 + (str[k] - '0');
					ret = max(ret, can + func(ns));
				}
			}
		}
	}

	return ret;
}

signed main() {
	char str [13];
	scanf("%s", str);
	int ans = func(str);
	printf("%d\n", ans);
	return 0;
}
0