bouzuya/firestore-structured-query のドキュメントを書いている。テストコードとドキュメントテストの重複をなんとかしたい……。位置づけが違うので難しいのだけど……。
PAST #4 : 第四回 アルゴリズム実技検定 過去問
- C - 隣接カウント
https://atcoder.jp/contests/past202010-open/tasks/past202010_c
- 提出: https://atcoder.jp/contests/past202010-open/submissions/50081236
- 各セルを走査し、セルごとに隣接セルとそのセルを走査して
#
をカウントする
use proconio::{input, marker::Chars}; fn main() { input! { n: usize, m: usize, s: [Chars; n], }; let mut a = vec![vec![0_usize; m]; n]; for i in 0..n { for j in 0..m { let mut count = 0_usize; for di in -1..=1 { for dj in -1..=1 { let (ni, nj) = (i as i64 + di, j as i64 + dj); if !(0..n as i64).contains(&ni) || !(0..m as i64).contains(&nj) { continue; } let (ni, nj) = (ni as usize, nj as usize); if s[ni][nj] == '#' { count += 1; } } } a[i][j] = count; } } for i in 0..n { for j in 0..m { print!("{}", a[i][j]); } println!(); } }
今日のコミット。
- rust-atcoder 1 commit
- firestore-structured-query 20 commits
- Add doc for Query::collection
- Add doc for Query
- Add doc for Order
- Add doc for Filter::or
- Add doc for Filter::and
- Add doc for Filter
- Add doc for FieldPath::descending
- Add doc for FieldPath::ascending
- Add doc for FieldPath::not_in
- Add doc for FieldPath::not_equal
- Add doc for FieldPath::less_than_or_equal
- Add doc for FieldPath::less_than
- Add doc for FieldPath::is_null
- Add doc for FieldPath::is_not_null
- Add doc for FieldPath::is_not_nan
- Add doc for FieldPath::is_nan
- Add doc for FieldPath::r#in
- Add doc for FieldPath::greater_than_or_equal
- Add doc for FieldPath::greater_than
- Add doc for FieldPath::equal