結果

問題 No.700 LOVE
ユーザー kohaku_kohaku
提出日時 2019-02-19 17:27:52
言語 Java
(openjdk 23)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 806 bytes
コンパイル時間 2,559 ms
コンパイル使用メモリ 75,548 KB
実行使用メモリ 41,824 KB
最終ジャッジ日時 2024-07-22 23:35:58
合計ジャッジ時間 6,132 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        List<String> list = new ArrayList<>();
        for(int i=0; i<n; i++) {
            list.add(sc.next());
        }
        solve(n,list);
    }
    
    static void solve(int n, List<String> list) {
        final String TARGET = "LOVE";
        if(discover(list,TARGET)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
    
    static boolean discover(List<String> list, String target) {
        for(String tmp : list) {
            if(tmp.contains(target)) {
                return true;
            }
        }
        return false;
    }
}
0