結果

問題 No.2692 How Many Times Reached?
ユーザー
提出日時 2024-07-31 17:56:28
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 569 bytes
コンパイル時間 11,574 ms
コンパイル使用メモリ 401,260 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-31 17:56:43
合計ジャッジ時間 13,793 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::Read;
fn j(c: Vec<char>) -> bool {
	!c.contains(&'B') && c.iter().filter(|&&x| x == '.').count() == 1
}
fn main() {
	let mut s = String::new();
	std::io::stdin().read_to_string(&mut s).ok();
	let c: Vec<Vec<_>> =
		s.lines().skip(1).map(|l| l.chars().collect()).collect();
	let n = c.len();
	let mut a = 0;
	a += j((0..n).map(|i| c[i][i]).collect()) as u8;
	a += j((0..n).map(|i| c[i][n - i - 1]).collect()) as u8;
	for i in 0..n {
		a += j((0..n).map(|j| c[i][j]).collect()) as u8;
		a += j((0..n).map(|j| c[j][i]).collect()) as u8;
	}
	println!("{a}")
}
0