結果

問題 No.1169 Row and Column and Diagonal
ユーザー motmot
提出日時 2020-08-14 22:15:55
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 876 bytes
コンパイル時間 1,623 ms
コンパイル使用メモリ 82,812 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 22:05:51
合計ジャッジ時間 4,805 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  int ans[N][N];
  for(int i=0;i<N;++i) {
    for(int j=0;j<N;++j) {
      if((i+j)%2==0) {
        ans[i][j] = (i+j+2)/2;
      }
      else {
        if(i+j>N) ans[i][j] = (i+j-N+2)/2;
        else ans[i][j] = (i+j+N+2)/2;
      }
    }
  }
  for(int i=0;i<N;++i) {
    for(int j=0;j<N;++j) {
      cout<<ans[i][j]<<" ";
    }
    cout<<endl;
  }
}

0