結果
| 問題 |
No.150 "良問"(良問とは言っていない
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-05-06 21:42:18 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 5,000 ms |
| コード長 | 894 bytes |
| コンパイル時間 | 615 ms |
| コンパイル使用メモリ | 73,052 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-11 02:01:06 |
| 合計ジャッジ時間 | 1,407 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(0);
std::string good = "good";
std::string problem = "problem";
int t;
std::cin >> t;
std::vector<std::string> s(t);
for(auto& it : s){
std::cin >> it;
}
for(auto it : s){
int ans = 11;
for(size_t i=0; i<=it.size()-11; ++i){
int cntGood = 0;
for(int j=0; j<4; ++j){
if(it[i+j]!=good[j]) ++cntGood;
}
for(size_t j=i+4; j<=it.size()-7; ++j){
int cntProblem = 0;
for(int k=0; k<7; ++k){
if(it[j+k]!=problem[k]) ++cntProblem;
}
ans = std::min(ans, cntGood+cntProblem);
}
}
std::cout << ans << "\n";
}
return 0;
}