結果

問題 No.883 ぬりえ
ユーザー phsplsphspls
提出日時 2022-12-13 09:48:45
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 540 bytes
コンパイル時間 1,576 ms
コンパイル使用メモリ 162,800 KB
実行使用メモリ 17,792 KB
最終ジャッジ日時 2024-04-24 20:48:09
合計ジャッジ時間 4,010 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 WA -
testcase_11 AC 1 ms
5,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 21 ms
17,792 KB
testcase_16 AC 6 ms
6,272 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut nk = String::new();
    std::io::stdin().read_line(&mut nk).ok();
    let nk: Vec<usize> = nk.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = nk[0];
    let k = nk[1];

    let cnt = ((n as f64).sqrt().ceil() as usize).max(n/k + if n%k>0 { 1 } else { 0 });
    println!("{}", cnt);
    let mut result = vec![vec!["."; cnt]; cnt];
    for i in 0..cnt {
        for j in 0..k.min(cnt) {
            result[i][(j+i)%cnt] = "#";
        }
        println!("{}", result[i].join(""));
    }
}
0