結果

問題 No.700 LOVE
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2019-02-19 17:27:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 806 bytes
コンパイル時間 2,002 ms
コンパイル使用メモリ 72,552 KB
実行使用メモリ 56,264 KB
最終ジャッジ日時 2023-09-30 05:39:49
合計ジャッジ時間 5,506 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,956 KB
testcase_01 AC 122 ms
55,780 KB
testcase_02 AC 125 ms
56,024 KB
testcase_03 AC 124 ms
56,024 KB
testcase_04 AC 126 ms
55,644 KB
testcase_05 AC 124 ms
56,012 KB
testcase_06 AC 121 ms
55,980 KB
testcase_07 AC 120 ms
55,776 KB
testcase_08 AC 121 ms
56,056 KB
testcase_09 AC 123 ms
55,472 KB
testcase_10 AC 129 ms
55,656 KB
testcase_11 AC 127 ms
56,264 KB
testcase_12 AC 131 ms
55,820 KB
testcase_13 AC 130 ms
55,780 KB
testcase_14 AC 132 ms
55,784 KB
testcase_15 AC 132 ms
55,672 KB
testcase_16 AC 128 ms
55,804 KB
testcase_17 AC 127 ms
55,772 KB
testcase_18 AC 129 ms
56,244 KB
権限があれば一括ダウンロードができます

ソースコード

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