結果

問題 No.150 "良問"(良問とは言っていない
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-21 22:51:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 231 ms / 5,000 ms
コード長 1,831 bytes
コンパイル時間 2,190 ms
コンパイル使用メモリ 78,092 KB
実行使用メモリ 58,308 KB
最終ジャッジ日時 2024-04-19 09:25:03
合計ジャッジ時間 6,449 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 181 ms
57,152 KB
testcase_01 AC 131 ms
54,076 KB
testcase_02 AC 127 ms
54,016 KB
testcase_03 AC 117 ms
53,144 KB
testcase_04 AC 128 ms
54,084 KB
testcase_05 AC 117 ms
52,976 KB
testcase_06 AC 231 ms
58,204 KB
testcase_07 AC 126 ms
54,060 KB
testcase_08 AC 127 ms
54,008 KB
testcase_09 AC 120 ms
53,108 KB
testcase_10 AC 183 ms
57,280 KB
testcase_11 AC 189 ms
57,688 KB
testcase_12 AC 165 ms
57,104 KB
testcase_13 AC 187 ms
57,576 KB
testcase_14 AC 188 ms
58,308 KB
testcase_15 AC 184 ms
58,252 KB
testcase_16 AC 136 ms
54,164 KB
testcase_17 AC 149 ms
56,176 KB
testcase_18 AC 183 ms
58,048 KB
testcase_19 AC 190 ms
58,020 KB
testcase_20 AC 201 ms
57,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner koko = new Scanner(System.in);
        int t = koko.nextInt();
        String[] s = new String[t];
        for(int i=0; i<t; i++){
            s[i]=koko.next();
            char[] sc = s[i].toCharArray();
            int len = s[i].length();
            int[] count = new int[10000];
            int co = 0;
            for(int j=0; j<len-10; j++){
                int n=11;
                if(sc[j]=='g'){
                    n--;
                }
                if(sc[j+1]=='o'){
                    n--;
                }
                if(sc[j+2]=='o'){
                    n--;
                }
                if(sc[j+3]=='d'){
                    n--;
                }
                for(int k=j+4; k<len-6; k++){
                    int kcount = n;
                    if(sc[k]=='p'){
                        kcount--;
                    }
                    if(sc[k+1]=='r'){
                        kcount--;
                    }
                    if(sc[k+2]=='o'){
                        kcount--;
                    }
                    if(sc[k+3]=='b'){
                        kcount--;
                    }
                    if(sc[k+4]=='l'){
                        kcount--;
                    }
                    if(sc[k+5]=='e'){
                        kcount--;
                    }
                    if(sc[k+6]=='m'){
                        kcount--;
                    }
                    count[co++]=kcount;
                }
            }
            int[] rcount = new int[co];
            for(int m=0; m<co; m++){
                rcount[m]=count[m];
            }
            Arrays.sort(rcount);
            System.out.println(rcount[0]);
        }
    }
}
0