結果

問題 No.150 "良問"(良問とは言っていない
ユーザー OnjuOnju
提出日時 2015-02-13 00:42:02
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,577 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 64,160 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-06 00:27:41
合計ジャッジ時間 1,252 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 1 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

//The ごり押し★
#include <iostream>
#include <algorithm>
#include <cstring>
#include <climits>
#include <string>
#include <sstream>
#include <vector>
#define T_MAX 100
#define S_LEN 100
using namespace std;
typedef unsigned long long ULL;
typedef long long LL;

int main()
{
	int T;
	string S[T_MAX];

	cin >> T;
	for (int i = 0; i < T; ++i)
		cin >> S[i];

	for (int s = 0; s < T; ++s)
	{
		int len = S[s].size();
		int goodscore = -1;
		int problemscore = -1;
		int maxscore = 100;

		for (int i = 0; i <= len - 11; ++i)
		{
			int score = 0;

			//for (int j = 7; j < i;++j)
			//{
			//	if (S[s][j - 7] == 'p'&&
			//		S[s][j - 6] == 'r'&&
			//		S[s][j - 5] == 'o'&&
			//		S[s][j - 4] == 'b'&&
			//		S[s][j - 3] == 'l'&&
			//		S[s][j - 2] == 'e'&&
			//		S[s][j - 1] == 'm')
			//		--score;
			//}
			if (S[s][i] == 'g')
				++score;
			if (S[s][i + 1] == 'o')
				++score;
			if (S[s][i + 2] == 'o')
				++score;
			if (S[s][i + 3] == 'd')
				++score;
			if (score > goodscore)
				goodscore = score;
			for (int j = i + 4; j <= len - 7; ++j)
			{
				score = 0;

				if (S[s][j] == 'p')
					++score;
				if (S[s][j + 1] == 'r')
					++score;
				if (S[s][j + 2] == 'o')
					++score;
				if (S[s][j + 3] == 'b')
					++score;
				if (S[s][j + 4] == 'l')
					++score;
				if (S[s][j + 5] == 'e')
					++score;
				if (S[s][j + 6] == 'm')
					++score;
				if (score > problemscore)
					problemscore = score;
			}

			if (maxscore > 11 - goodscore - problemscore)
				maxscore = 11 - goodscore - problemscore;
		}

		cout << maxscore << endl;
	}

	return 0;
}
0