結果
問題 | No.1169 Row and Column and Diagonal |
ユーザー |
|
提出日時 | 2020-08-14 22:07:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 443 bytes |
コンパイル時間 | 164 ms |
コンパイル使用メモリ | 31,872 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-10 15:23:22 |
合計ジャッジ時間 | 1,335 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 |
ソースコード
#include<cstdio> int a[505][505]; int main(){ int n; scanf("%d",&n); int r = 0, c = 0; for(int i = 1; i <= n; i++){ int x = r, y = c; for(int j = 1; j <= n; j++){ a[x][y] = j; x = (x+1)%n, y = (y+1)%n; } r = (r+2)%n, c = (c+1)%n; } for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++) printf("%d ",a[i][j]); printf("\n"); } return 0; }