結果
| 問題 |
No.437 cwwゲーム
|
| コンテスト | |
| ユーザー |
nenuon
|
| 提出日時 | 2017-07-01 13:04:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 943 bytes |
| コンパイル時間 | 796 ms |
| コンパイル使用メモリ | 90,456 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 08:43:51 |
| 合計ジャッジ時間 | 1,911 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 41 |
ソースコード
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;
ll ans;
void calc (string s, ll score) {
int len = s.length();
ans = max(ans, score);
if(len < 3) return;
FOR(i,0,len-2){
FOR(j,i+1,len-1){
FOR(k,j+1,len){
if(s[j] == s[k] && s[k] != s[i] && s[i] != '0') {
string ns = "";
FOR(l,0,len) {
if(l == i || l == j || l == k) continue;
ns += s[l];
}
calc(ns, score + 100 * (s[i] - '0') + 10 * (s[j] - '0') + (s[k] - '0'));
}
}
}
}
return;
}
int main(){
string ss;
cin >> ss;
ans = 0;
calc(ss, 0);
cout << ans << endl;
return 0;
}
nenuon