結果
問題 | No.1005 BOT対策 |
ユーザー |
![]() |
提出日時 | 2020-08-24 17:33:43 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 109 ms / 2,000 ms |
コード長 | 510 bytes |
コンパイル時間 | 1,798 ms |
コンパイル使用メモリ | 76,964 KB |
実行使用メモリ | 54,496 KB |
最終ジャッジ日時 | 2025-01-01 20:12:52 |
合計ジャッジ時間 | 5,968 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
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);}}