結果
| 問題 | 
                            No.1005 BOT対策
                             | 
                    
| コンテスト | |
| ユーザー | 
                             キョウチク
                         | 
                    
| 提出日時 | 2022-05-17 19:07:09 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 563 bytes | 
| コンパイル時間 | 3,593 ms | 
| コンパイル使用メモリ | 76,852 KB | 
| 実行使用メモリ | 41,548 KB | 
| 最終ジャッジ日時 | 2024-09-15 14:13:09 | 
| 合計ジャッジ時間 | 8,523 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 WA * 6 | 
ソースコード
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)){
        targeted++;
        if(2<target_l){
          i+=target_l-2;
        }
      }
    }
    System.out.println(targeted);
    sc.close();
  }
}
            
            
            
        
            
キョウチク