結果

問題 No.1169 Row and Column and Diagonal
ユーザー ixTL255
提出日時 2023-02-13 00:50:50
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 11,715 ms
コンパイル使用メモリ 384,280 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-16 08:14:57
合計ジャッジ時間 12,649 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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