結果

問題 No.3125 Make It Symmetry
ユーザー ks2m
提出日時 2025-04-25 22:16:45
言語 Java
(openjdk 23)
結果
AC  
実行時間 234 ms / 2,000 ms
コード長 586 bytes
コンパイル時間 7,418 ms
コンパイル使用メモリ 85,012 KB
実行使用メモリ 59,044 KB
最終ジャッジ日時 2025-04-25 22:17:09
合計ジャッジ時間 16,235 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[][] s = new char[n][n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.next().toCharArray();
		}
		sc.close();

		if (n % 2 == 1) {
			System.out.println("Yes");
			return;
		}

		int cnt = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (s[i][j] == '#') {
					cnt++;
				}
			}
		}
		if (cnt % 2 == 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}
0