結果

問題 No.1169 Row and Column and Diagonal
ユーザー Victor Alfredo Torres Ramirez
提出日時 2020-08-22 00:17:31
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 458 bytes
コンパイル時間 1,651 ms
コンパイル使用メモリ 138,860 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-22 08:10:37
合計ジャッジ時間 3,034 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

// Vicfred
// https://yukicoder.me/problems/no/1169
// implementation
import std.stdio;

void main() {
    int n;
    readf("%s", &n);

    int[][] ans = new int[][](n,n);

    for(int i = 0; i < n; i++)
        for(int j = i, cnt = 0, num = i + 1; cnt < n; ++j, j %= n, ++cnt, --num, num <= 0 ? num = n : 0)
            ans[i][j] = num;

    foreach(row; ans) {
        foreach(item; row) {
            writef("%s ", item);
        } writefln("");
    }
}

0