結果
| 問題 |
No.150 "良問"(良問とは言っていない
|
| コンテスト | |
| ユーザー |
Kutimoti_T
|
| 提出日時 | 2017-12-27 22:29:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 5,000 ms |
| コード長 | 576 bytes |
| コンパイル時間 | 471 ms |
| コンパイル使用メモリ | 56,520 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-11 02:13:10 |
| 合計ジャッジ時間 | 1,279 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
#define FOR(i,s,e) for(int i = (s);i <= (e);i++)
int N;
string S;
const string good = "good";
const string problem = "problem";
int main()
{
cin >> N;
FOR(cou,0,N - 1)
{
cin >> S;
int min_ = 20;
FOR(i,0,S.size() - 11)
{
int temp = 0;
FOR(k,0,3)
{
if(S[i + k] != good[k]) temp++;
}
FOR(j,i + 4,S.size() - 7)
{
int temp2 = temp;
FOR(k,0,6)
{
if(S[j + k] != problem[k]) temp2++;
}
min_ = min(min_,temp2);
}
}
cout << min_ << endl;
}
return 0;
}
Kutimoti_T