結果

問題 No.430 文字列検索
ユーザー htensaihtensai
提出日時 2019-11-19 21:01:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,954 ms / 2,000 ms
コード長 413 bytes
コンパイル時間 1,884 ms
コンパイル使用メモリ 74,528 KB
実行使用メモリ 58,940 KB
最終ジャッジ日時 2024-04-15 00:56:56
合計ジャッジ時間 15,009 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
54,152 KB
testcase_01 AC 359 ms
58,164 KB
testcase_02 AC 527 ms
57,628 KB
testcase_03 AC 518 ms
58,656 KB
testcase_04 AC 115 ms
54,208 KB
testcase_05 AC 127 ms
54,136 KB
testcase_06 AC 126 ms
54,264 KB
testcase_07 AC 123 ms
53,980 KB
testcase_08 AC 183 ms
54,304 KB
testcase_09 AC 136 ms
54,496 KB
testcase_10 AC 164 ms
54,188 KB
testcase_11 AC 1,099 ms
58,432 KB
testcase_12 AC 1,403 ms
58,924 KB
testcase_13 AC 1,369 ms
57,692 KB
testcase_14 AC 1,233 ms
57,628 KB
testcase_15 AC 1,023 ms
57,684 KB
testcase_16 AC 1,546 ms
58,576 KB
testcase_17 AC 1,954 ms
58,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String target = sc.next();
		int m = sc.nextInt();
		int count = 0;
		for (int i = 0; i < m; i++) {
		    String test = sc.next();
		    int idx = 0;
		    while ((idx = target.indexOf(test, idx)) != -1) {
		        idx++;
		        count++;
		    }
		}
		System.out.println(count);
	}
}
0