結果
問題 |
No.1005 BOT対策
|
ユーザー |
![]() |
提出日時 | 2020-08-24 17:33:43 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 119 ms / 2,000 ms |
コード長 | 510 bytes |
コンパイル時間 | 2,419 ms |
コンパイル使用メモリ | 77,100 KB |
実行使用メモリ | 46,676 KB |
最終ジャッジ日時 | 2025-06-20 00:54:01 |
合計ジャッジ時間 | 7,437 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); String t = sc.next(); if (t.length() == 1 && s.indexOf(t) >= 0) { System.out.println(-1); return; } int idx = 0; int count = 0; while ((idx = s.indexOf(t, idx)) >= 0) { count++; idx += t.length() - 1; } System.out.println(count); } }