結果

問題 No.437 cwwゲーム
ユーザー newlife171128newlife171128
提出日時 2018-01-11 00:27:55
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,378 bytes
コンパイル時間 659 ms
コンパイル使用メモリ 77,080 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-25 10:43:29
合計ジャッジ時間 3,031 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
#include <stack>
#include <cctype>
#include <stdio.h>
#include <map>
#include <string.h>

using namespace std;

int used_index[13];

int max_i;
int max_j;
int max_k;

long long tmp_max = 0;

long long ans=0;

int main() {

	string s;
	cin >> s;

	bool judge = true;
	while (judge) {
		/*	memset(used_index,0,sizeof(used_index));*/
		judge = false;
		tmp_max =0;
		for (int i = 0; i < s.length() - 2; i++) {
			for (int j = i + 1; j < s.length() - 1; j++) {
				for (int k = j + 1; k < s.length(); k++) {
					if (s[j] == s[k] && s[i] != s[j]) {
						if (used_index[i] == 0 && used_index[j] == 0
								&& used_index[k] == 0) {

							if (tmp_max
									< (s[i] - '0') * 100 + (s[j] - '0') * 10
											+ s[j] - '0') {

								tmp_max = (s[i] - '0') * 100 + (s[j] - '0') * 10+ s[j] - '0';

								max_i = i;
								max_j =j;
								max_k =k;

						/*		cout<<max_i<<" "<<max_j<<" "<<max_k<<endl;*/
						}

						/*							cout
						 << (s[i] - '0') * 100 + (s[j] - '0') * 10
						 + s[j] - '0' << endl;*/
						judge = true;
					}

				}
			}
		}
	}
	if (judge) {
/*		cout<<tmp_max<<endl;
		return 0;*/
		used_index[max_i] = 1;
		used_index[max_j] = 1;
		used_index[max_k] = 1;
		ans += tmp_max;
	}
}

	cout<<ans<<endl;

return 0;
}
0