結果
問題 | No.150 "良問"(良問とは言っていない |
ユーザー |
![]() |
提出日時 | 2016-02-19 13:50:29 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 27 ms / 5,000 ms |
コード長 | 788 bytes |
コンパイル時間 | 486 ms |
コンパイル使用メモリ | 63,832 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 02:00:00 |
合計ジャッジ時間 | 1,334 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 20 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; #define RREP(i,s,e) for (i = e-1; i >= s; i--) #define rrep(i,n) RREP(i,0,n) #define REP(i,s,e) for (i = s; i < e; i++) #define rep(i,n) REP(i,0,n) #define INF 1e8 int diff(string s, string t) { int i, cnt = 0; rep (i,s.size()) { if (s[i] != t[i]) cnt++; } return cnt; } int main() { int i, t; cin >> t; rep (i,t) { string s; int x, y, ans = INF; cin >> s; rep (x,s.size()-10) REP (y,x+4,s.size()-6) { int cnt = 0; string g = "good"; string p = "problem"; ans = min(ans,diff(s.substr(x,4),g)+diff(s.substr(y,7),p)); } cout << ans << endl; } return 0; }