結果

問題 No.1169 Row and Column and Diagonal
ユーザー saikatoto
提出日時 2020-08-15 16:34:29
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 284 bytes
コンパイル時間 3,018 ms
コンパイル使用メモリ 191,552 KB
最終ジャッジ日時 2025-01-13 01:33:13
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      int ans = 2 * (i+1) - j - 1 + n;
      ans %= n;
      if(ans == 0) ans = n;
      cout << ans << " ";
    }
    cout << endl;
  }
}
0