結果

問題 No.150 "良問"(良問とは言っていない
ユーザー woodsgreenwoodsgreen
提出日時 2022-12-16 16:21:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 658 bytes
コンパイル時間 1,973 ms
コンパイル使用メモリ 201,936 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-27 17:20:03
合計ジャッジ時間 2,967 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 3 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 3 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int t;
char s[110],S[10]="good",T[10]="problem";
int main(){
    cin>>t;
    for(int i=0;i<t;++i){
        cin>>s;
        int len=strlen(s),a[110]={},b[110]={};
        for(int j=0;j<=len-11;++j)
            for(int k=0;k<4;++k)
                a[j]+=(s[j+k]!=S[k]);
        for(int j=4;j<=len-7;++j)
            for(int k=0;k<7;++k)
                b[j]+=(s[j+k]!=T[k]);
        int minn=20;
        for(int j=0;j<=len-11;++j)
            for(int k=j+4;k<=len-7;++k)
                if(a[j]+b[k]<minn)
                    minn=a[j]+b[k];
        cout<<minn<<endl;
    }
    return 0;
}
0