結果

問題 No.1169 Row and Column and Diagonal
ユーザー ixTL255ixTL255
提出日時 2023-02-13 00:50:50
言語 Rust
(1.77.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 1,342 ms
コンパイル使用メモリ 152,100 KB
実行使用メモリ 5,620 KB
最終ジャッジ日時 2023-09-23 08:26:39
合計ジャッジ時間 2,548 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

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

    let mut ans = vec![vec![1; n]; n];

    for i in 0..n {
        for j in 0..n {
            ans[i][j] = (2 * i - j + n) % n + 1;
        }
    }

	let s =
        ans.iter()
        .map(|x| x.iter().map(|y| y.to_string()).collect::<Vec<String>>().join(" "))
        .collect::<Vec<String>>().join("\n");
	println!("{}", s);
}
0