結果
| 問題 |
No.150 "良問"(良問とは言っていない
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-07 22:00:30 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 776 bytes |
| コンパイル時間 | 2,068 ms |
| コンパイル使用メモリ | 194,600 KB |
| 最終ジャッジ日時 | 2025-01-07 10:58:42 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int t;
cin>>t;
while (t--) {
string s;
cin>>s;
int n=s.size();
int ans=11;
for (int i=0;i+3<n;i++) {
for (int j=i+4;j+6<n;j++) {
int cnt=0;
cnt+=s[i]!='g';
cnt+=s[i+1]!='o';
cnt+=s[i+2]!='o';
cnt+=s[i+3]!='d';
cnt+=s[j]!='p';
cnt+=s[j+1]!='r';
cnt+=s[j+2]!='o';
cnt+=s[j+3]!='b';
cnt+=s[j+4]!='l';
cnt+=s[j+5]!='e';
cnt+=s[j+6]!='m';
ans=min(ans,cnt);
}
}
cout<<ans<<endl;
}
return 0;
}