結果
問題 | No.150 "良問"(良問とは言っていない |
ユーザー |
![]() |
提出日時 | 2017-07-09 23:20:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 5,000 ms |
コード長 | 525 bytes |
コンパイル時間 | 1,574 ms |
コンパイル使用メモリ | 168,452 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 02:11:46 |
合計ジャッジ時間 | 2,398 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> #define REP(i,n,N) for(int i=(n);i<(int) N;i++) #define p(s) cout<<(s)<<endl using namespace std; const int inf=1e9; int main(){ int T; cin>>T; string s; string good="good"; string prob="problem"; REP(i,0,T){ cin>>s; int mn=inf; REP(j,0,s.size()-10){ int cnt=0; REP(k,0,good.size()){ cnt+= s[j+k]!=good[k]; } REP(jj,j+4,s.size()-6){ int cnt2=0; REP(k,0,prob.size()){ cnt2+= s[jj+k]!=prob[k]; } mn=min(mn,cnt+cnt2); } } p(mn); } return 0; }