結果

問題 No.700 LOVE
ユーザー CecilCecil
提出日時 2023-01-12 20:30:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 707 bytes
コンパイル時間 1,998 ms
コンパイル使用メモリ 71,948 KB
実行使用メモリ 56,932 KB
最終ジャッジ日時 2023-08-25 01:44:12
合計ジャッジ時間 5,720 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
56,260 KB
testcase_01 AC 121 ms
56,032 KB
testcase_02 AC 124 ms
55,680 KB
testcase_03 AC 124 ms
55,928 KB
testcase_04 AC 123 ms
55,992 KB
testcase_05 AC 125 ms
56,072 KB
testcase_06 AC 125 ms
55,896 KB
testcase_07 AC 123 ms
55,720 KB
testcase_08 AC 124 ms
55,988 KB
testcase_09 AC 126 ms
56,252 KB
testcase_10 AC 147 ms
56,280 KB
testcase_11 AC 158 ms
56,732 KB
testcase_12 AC 161 ms
56,248 KB
testcase_13 AC 158 ms
56,388 KB
testcase_14 AC 165 ms
56,932 KB
testcase_15 AC 162 ms
56,520 KB
testcase_16 AC 166 ms
56,352 KB
testcase_17 AC 159 ms
56,468 KB
testcase_18 AC 161 ms
56,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static String word = "LOVE";

	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);

		int n = scan.hasNextInt() ? scan.nextInt() : -1;
		int m = scan.hasNextInt() ? scan.nextInt() : -1;
		if (n > 50 || n < 2 || m > 50 || m < 2) {
			System.out.println("入力エラー1");
			return;
		}

		String[][] str = new String[n][m];
		String ans = "NO";

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				str[i][j] = scan.hasNextLine() ? scan.nextLine() : null;

				if (str[i][j] != null && str[i][j].contains(word)) {
					ans = "YES";
					break;
				}
			}
		}

		// 結果出力
		System.out.println(ans);

	}
}
0