結果
問題 |
No.86 TVザッピング(2)
|
ユーザー |
|
提出日時 | 2014-12-07 18:35:04 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 813 bytes |
コンパイル時間 | 3,848 ms |
コンパイル使用メモリ | 79,852 KB |
実行使用メモリ | 47,924 KB |
最終ジャッジ日時 | 2025-06-20 13:58:07 |
合計ジャッジ時間 | 8,425 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 WA * 13 |
ソースコード
import java.util.Scanner; public class Yukicoder85 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(); String[] a = new String[n]; for (int i = 0; i < n; i++) a[i] = sc.next(); int oddCount = 0, buf; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (a[i].charAt(j) == '#') continue; buf = 0; if (i - 1 >= 0) buf += a[i - 1].charAt(j) == '.' ? 1 : 0; if (i + 1 < n) buf += a[i + 1].charAt(j) == '.' ? 1 : 0; if (j - 1 >= 0) buf += a[i].charAt(j - 1) == '.' ? 1 : 0; if (j + 1 < m) buf += a[i].charAt(j + 1) == '.' ? 1 : 0; if (buf % 2 == 0) oddCount++; } } if (oddCount % 2 == 0) System.out.println("YES"); else System.out.println("NO"); } }