結果
| 問題 |
No.150 "良問"(良問とは言っていない
|
| コンテスト | |
| ユーザー |
ry0u_yd
|
| 提出日時 | 2015-09-04 02:06:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 5,000 ms |
| コード長 | 995 bytes |
| コンパイル時間 | 741 ms |
| コンパイル使用メモリ | 68,384 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-11 01:56:22 |
| 合計ジャッジ時間 | 1,375 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main() {
int t;
cin >> t;
rep(q,t) {
string s;
cin >> s;
int n = s.size();
string g = "good", p = "problem";
int ans = INF;
rep(i,n) {
REP(j,i+4,n-6) {
int cnt = 0;
string t = s.substr(i,4);
rep(k,4) {
if(t[k] != g[k]) cnt++;
}
string t2 = s.substr(j,7);
rep(k,7) {
if(t2[k] != p[k]) cnt++;
}
ans = min(ans,cnt);
}
}
cout << ans << endl;
}
return 0;
}
ry0u_yd