結果

問題 No.437 cwwゲーム
ユーザー butter_rollbutter_roll
提出日時 2016-10-29 01:04:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 961 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 63,304 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 13:03:06
合計ジャッジ時間 1,437 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <typeinfo>
using namespace std;

vector<int> a;
int n;

int sol(int x,int y, int z,int box[15]){
  int tmp=0,res=0;
  int i,j,k;

  for(i=x;i<n;i++){
    //cout<<"a";
    for(j=i+1;j<n;j++){
      //cout<<"b";
      for(k=j+1;k<n;k++){
        //cout<<"c";
        if(a[i]!=0&&a[i]!=a[j]&&a[j]==a[k]&&box[i]!=1&&box[j]!=1&&box[k]!=1) {

          //cout<<"waro"<<endl;
          box[i]=box[j]=box[k]=1;
          tmp=sol(0,1,2,box)+a[i]*100+a[j]*11;
          box[i]=box[j]=box[k]=0;
          //res+=a[i]*100+a[j]*11;
          res=max(tmp,res);
        }
      }
    }
  }

  return res;
}

int main(void){
  
  int i,l,r,k,t,j,tmp;
  int N;
  int res=0;
  string s;
  int box[15];
  
  cin>>s;
  n=s.length();
  a.resize(n);

  for(i=0;i<15;i++) box[i]=0;
  for(i=0;i<n;i++){
    a[i]=s[i]-'0';
  }

  tmp=sol(0,1,2,box);
  cout<<tmp<<endl;
  return 0;
}
0