結果

問題 No.1851 Regular Tiling
ユーザー phsplsphspls
提出日時 2022-09-27 00:09:24
言語 Rust
(1.77.0)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 1,062 bytes
コンパイル時間 5,925 ms
コンパイル使用メモリ 150,544 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-24 03:18:55
合計ジャッジ時間 3,193 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 28 ms
4,376 KB
testcase_02 AC 34 ms
4,380 KB
testcase_03 AC 32 ms
4,376 KB
testcase_04 AC 30 ms
4,376 KB
testcase_05 AC 32 ms
4,380 KB
testcase_06 AC 35 ms
4,380 KB
testcase_07 AC 29 ms
4,380 KB
testcase_08 AC 30 ms
4,380 KB
testcase_09 AC 35 ms
4,376 KB
testcase_10 AC 32 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 59 ms
4,380 KB
testcase_14 AC 102 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 result = (0..=h).map(|i| {
                let ret = if i % 3 == 0 { (0..=w).map(|j| if j % 3 == 0 { "0" } else { "1" }).collect::<Vec<_>>().join("") }
                    else { (0..=w).map(|j| if j % 3 == 0 { "1" } else { "2" }).collect::<Vec<_>>().join("") };
                ret.chars().collect::<Vec<_>>()
            })
            .collect::<Vec<_>>();
        let hstart = if h % 3 == 2 { 1 } else { 0 };
        let wstart = if w % 3 == 2 { 1 } else { 0 };
        for i in 0..h {
            for j in 0..w {
                print!("{}{}", result[i+hstart][j+wstart], if j < w-1 { " " } else { "" });
            }
            println!();
        }
    }
}
0