結果

問題 No.1005 BOT対策
ユーザー キョウチクキョウチク
提出日時 2022-05-17 19:10:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 660 bytes
コンパイル時間 4,394 ms
コンパイル使用メモリ 72,092 KB
実行使用メモリ 56,408 KB
最終ジャッジ日時 2023-10-13 18:33:45
合計ジャッジ時間 9,688 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
55,680 KB
testcase_01 AC 108 ms
56,020 KB
testcase_02 AC 109 ms
55,780 KB
testcase_03 AC 107 ms
55,892 KB
testcase_04 AC 113 ms
56,152 KB
testcase_05 AC 115 ms
55,484 KB
testcase_06 AC 117 ms
56,000 KB
testcase_07 AC 109 ms
55,844 KB
testcase_08 AC 117 ms
55,496 KB
testcase_09 AC 109 ms
54,120 KB
testcase_10 AC 109 ms
55,636 KB
testcase_11 AC 107 ms
55,692 KB
testcase_12 AC 113 ms
56,332 KB
testcase_13 AC 116 ms
55,868 KB
testcase_14 AC 112 ms
54,584 KB
testcase_15 AC 112 ms
55,900 KB
testcase_16 AC 113 ms
55,976 KB
testcase_17 AC 112 ms
55,692 KB
testcase_18 AC 111 ms
55,576 KB
testcase_19 AC 110 ms
55,852 KB
testcase_20 AC 112 ms
56,192 KB
testcase_21 AC 117 ms
56,212 KB
testcase_22 AC 113 ms
55,748 KB
testcase_23 AC 116 ms
55,988 KB
testcase_24 AC 115 ms
55,972 KB
testcase_25 AC 111 ms
56,000 KB
testcase_26 AC 111 ms
55,940 KB
testcase_27 AC 116 ms
56,408 KB
testcase_28 AC 114 ms
55,784 KB
testcase_29 AC 110 ms
56,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Test11 {
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String line;
    line=sc.nextLine();
    String msg=line;
    line=sc.nextLine();
    String target=line;
    int msg_l=msg.length(),target_l=target.length(),targeted=0;
    for(int i=0;i<msg_l-target_l+1;i++){
      String tmp=msg.substring(i,i+target_l);
      if(tmp.equals(target)){
        if(1<target_l){
          targeted++;
          if(2<target_l){
            i+=target_l-2;
          }
        }else{
          targeted=-1;
          break;
        }
      }
    }
    System.out.println(targeted);
    sc.close();
  }
}
0