結果

問題 No.150 "良問"(良問とは言っていない
ユーザー OnjuOnju
提出日時 2015-02-13 00:47:49
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 1,424 bytes
コンパイル時間 540 ms
コンパイル使用メモリ 63,120 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-19 09:16:07
合計ジャッジ時間 1,324 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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 maxscore = 100;

		for (int i = 0; i <= len - 11; ++i)
		{
			int gscore = 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')
				++gscore;
			if (S[s][i + 1] == 'o')
				++gscore;
			if (S[s][i + 2] == 'o')
				++gscore;
			if (S[s][i + 3] == 'd')
				++gscore;
			for (int j = i + 4; j <= len - 7; ++j)
			{
				int pscore = 0;

				if (S[s][j] == 'p')
					++pscore;
				if (S[s][j + 1] == 'r')
					++pscore;
				if (S[s][j + 2] == 'o')
					++pscore;
				if (S[s][j + 3] == 'b')
					++pscore;
				if (S[s][j + 4] == 'l')
					++pscore;
				if (S[s][j + 5] == 'e')
					++pscore;
				if (S[s][j + 6] == 'm')
					++pscore;
				if (maxscore > 11 - gscore - pscore)
					maxscore = 11 - gscore - pscore;
			}
		}

		cout << maxscore << endl;
	}

	return 0;
}
0