結果
問題 | No.1851 Regular Tiling |
ユーザー |
|
提出日時 | 2022-09-27 00:09:24 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 106 ms / 2,000 ms |
コード長 | 1,062 bytes |
コンパイル時間 | 15,826 ms |
コンパイル使用メモリ | 379,164 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-22 16:07:22 |
合計ジャッジ時間 | 17,473 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 14 |
ソースコード
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!(); } } }