結果
問題 | No.150 "良問"(良問とは言っていない |
ユーザー |
![]() |
提出日時 | 2015-07-07 19:03:12 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 5 ms / 5,000 ms |
コード長 | 487 bytes |
コンパイル時間 | 1,343 ms |
コンパイル使用メモリ | 158,808 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 01:55:28 |
合計ジャッジ時間 | 2,103 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; string good="good",problem="problem"; string s; while(t--){ cin>>s; int ans=11,length=(int)s.size(); for(int i=0;i<length-10;i++){ int temp1=0; for(int g=0;g<4;g++){ if(good[g]!=s[i+g]) temp1++; } for(int j=i+4;j<length-6;j++){ int temp2=0; for(int p=0;p<7;p++){ if(problem[p]!=s[j+p]) temp2++; } ans=min(ans,temp1+temp2); } } cout<<ans<<endl; } return 0; }