結果

問題 No.1851 Regular Tiling
ユーザー phsplsphspls
提出日時 2022-09-27 18:33:21
言語 Rust
(1.77.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 728 bytes
コンパイル時間 860 ms
コンパイル使用メモリ 150,616 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-24 03:58:41
合計ジャッジ時間 3,091 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 10 ms
4,376 KB
testcase_02 AC 11 ms
4,376 KB
testcase_03 AC 10 ms
4,376 KB
testcase_04 AC 11 ms
4,376 KB
testcase_05 AC 10 ms
4,376 KB
testcase_06 AC 12 ms
4,376 KB
testcase_07 AC 11 ms
4,380 KB
testcase_08 AC 11 ms
4,376 KB
testcase_09 AC 11 ms
4,376 KB
testcase_10 AC 11 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 19 ms
4,376 KB
testcase_14 AC 25 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut t = String::new();
    std::io::stdin().read_line(&mut t).ok();
    let t: usize = t.trim().parse().unwrap();
    for _ in 0..t {
        let mut hw = String::new();
        std::io::stdin().read_line(&mut hw).ok();
        let hw: Vec<usize> = hw.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
        let h = hw[0];
        let w = hw[1];

        let base = vec![vec!["0", "1", "1"], vec!["1", "2", "2"], vec!["1", "2", "2"]];
        let starth = if h % 3 == 2 { 1 } else { 0 };
        let startw = if w % 3 == 2 { 1 } else { 0 };
        for i in 0..h {
            println!("{}", (0..w).map(|j| base[(starth+i)%3][(startw+j)%3]).collect::<Vec<_>>().join(" "));
        }
    }
}
0