結果
| 問題 |
No.150 "良問"(良問とは言っていない
|
| コンテスト | |
| ユーザー |
Lepton_s
|
| 提出日時 | 2015-02-12 23:37:12 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 609 bytes |
| コンパイル時間 | 428 ms |
| コンパイル使用メモリ | 56,924 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-11 01:45:58 |
| 合計ジャッジ時間 | 1,147 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
#define N 110
int d[2][N];
int n;
string s;
int u(int a, string t, int l){
int r = 0;
for(int i = 0; i < l; i++)
r += (s[a+i]!=t[i]);
return r;
}
int main(){
int T;
cin>>T;
while(T--){
cin>>s;
//memset(d, 0, sizeof(d));
n = s.size();
for(int i = 0; i <= n-4; i++)
d[0][i] = u(i, "good", 4);
for(int i = 0; i <= n-7; i++)
d[1][i] = u(i, "problem", 7);
int res = 9999;
for(int i = 0; i < n; i++)
for(int j = i+4; j <= n-7; j++)
res = min(res, d[0][i]+d[1][j]);
cout<<res<<endl;
}
return 0;
}
Lepton_s