結果
| 問題 |
No.150 "良問"(良問とは言っていない
|
| コンテスト | |
| ユーザー |
dnish
|
| 提出日時 | 2018-06-08 14:26:15 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,110 bytes |
| コンパイル時間 | 745 ms |
| コンパイル使用メモリ | 84,328 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-11 02:13:47 |
| 合計ジャッジ時間 | 1,503 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 20 |
ソースコード
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf=1e9+7;
int T;
string s;
int main(){
cin>>T;
string s1 = "good";
string s2 = "problem";
REP(i,0,T){
int ans=11;
cin>>s;
int n= s.size();
int good[110] = {};
int prob[110] = {};
REP(i,0,n-6){
REP(j,0,4){
good[i] += (s[i+j] == s1[j]);
}
REP(j,0,7){
prob[i] += (s[i+j] == s2[j]);
}
}
RREP(i,1,n-6){
prob[i-1]=max(prob[i-1], prob[i]);
}
REP(i,0,n-10){
ans=min(ans, 11 - good[i] - prob[i+4]);
}
p(ans);
}
return 0;
}
dnish