結果

問題 No.1851 Regular Tiling
ユーザー phsplsphspls
提出日時 2022-10-03 23:40:33
言語 Rust
(1.77.0)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 712 bytes
コンパイル時間 980 ms
コンパイル使用メモリ 150,840 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-27 21:17:48
合計ジャッジ時間 4,399 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 26 ms
4,380 KB
testcase_02 AC 32 ms
4,376 KB
testcase_03 AC 29 ms
4,376 KB
testcase_04 AC 28 ms
4,376 KB
testcase_05 AC 30 ms
4,376 KB
testcase_06 AC 34 ms
4,380 KB
testcase_07 AC 27 ms
4,376 KB
testcase_08 AC 29 ms
4,376 KB
testcase_09 AC 33 ms
4,380 KB
testcase_10 AC 30 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 54 ms
4,380 KB
testcase_14 AC 96 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut t = String::new();
    std::io::stdin().read_line(&mut t).ok();
    let t: usize = t.trim().parse().unwrap();

    let base = vec![vec![0,1,1], vec![1,2,2], vec![1,2,2]];
    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 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].to_string()).collect::<Vec<_>>().join(" "));
        }
    }
}
0