結果

問題 No.437 cwwゲーム
ユーザー ohreitetsuohreitetsu
提出日時 2018-05-30 23:08:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,021 bytes
コンパイル時間 554 ms
コンパイル使用メモリ 66,572 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-12 20:50:39
合計ジャッジ時間 2,059 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <string.h>
using namespace std;
int getValue(string &S,int x,int y,int z)
{
	string S1;
	S1=S[x];
	S1+=S[y];
	S1+=S[z];
	S.erase(z,1);
	S.erase(y,1);
	S.erase(x,1);
	return atol(S1.c_str());
}
bool Check(string S,int x,int y,int z)
{
	if (S[y]==S[z]){
		return true;
	}else{
		return false;
	}
}

int deal(string &S)
{
	int i,j,k;
	int sLen=S.length();
	int value=0;
	for (i=0;i<sLen-2;i++){
		for (j=i+1;j<sLen-1;j++){
			for (k=j+1;k<sLen;k++){
				if (S[i]!=S[j] && S[j]==S[k]){
					value=+getValue(S,i,j,k);
					return value;
				}
			}
		}
	}
	return 0;
}
int main(int argc, char* argv[])
{
	string N,N1;
	int maxScore=0;
	cin>>N;
	int nLen=N.length();
	if (nLen<=2){
		cout<<0<<endl;
		return 0;
	}
	int i;
	for (i=0;i<nLen-2;i++){
		string n=N.c_str()+i;
		int score=0;
		while (n.length()>0){
			int value=deal(n);
			if (value>0){
				score+=value;
			}else{
				break;
			}
		}
		if (maxScore<score){
			maxScore=score;
		}
	}
	cout<<maxScore<<endl;
	return 0;
}
0