結果
| 問題 |
No.252 "良問"(良問とは言っていない (2)
|
| コンテスト | |
| ユーザー |
IL_msta
|
| 提出日時 | 2015-07-25 00:04:59 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,585 bytes |
| コンパイル時間 | 637 ms |
| コンパイル使用メモリ | 86,428 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-16 02:14:08 |
| 合計ジャッジ時間 | 5,924 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 3 |
ソースコード
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <string>
//#include <array>
#include <list>
#include <queue>
#include <vector>
#include <complex>
#include <set>
#include <map>
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
#define PII pair<int,int>
/////////
typedef long long LL;
typedef long double LD;
/////////
using namespace::std;
/////////
int ans[100000];
bool check(string str){
int a,b;
a = str.find("good");
if(a == -1){
return false;
}
b = str.find("problem",a);
if( b == -1){
return false;
}
return true;
}
int solve(string str){
//goodp roble m
int LenA,LenB;
int ans=12,tans;
for(int i=0;i<=str.size()-11;++i){
LenA = 0;
if(str[i ] != 'g')LenA++;
if(str[i+1] != 'o')LenA++;
if(str[i+2] != 'o')LenA++;
if(str[i+3] != 'd')LenA++;
if(ans <= LenA) continue;
for(int j=i+4;j<=str.size()-7;++j){
LenB = 0;
if(str[j ] != 'p')LenB++;
if(str[j+1] != 'r')LenB++;
if(str[j+2] != 'o')LenB++;
if(str[j+3] != 'b')LenB++;
if(str[j+4] != 'l')LenB++;
if(str[j+5] != 'e')LenB++;
if(str[j+6] != 'm')LenB++;
tans = LenA+LenB;
ans = min(ans,tans);
if(ans == 0){
break;
}
}
}
return ans;
}
int main(void){
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cout << std::fixed;//
//cout << setprecision(16);//
int T;
cin>>T;
string str;
rep(i,T){
cin>>str;
ans[i] = solve(str);
}
rep(i,T){
P(ans[i]);
}
return 0;
}
IL_msta