結果
問題 |
No.839 Keep Distance and Nobody Explodes
|
ユーザー |
![]() |
提出日時 | 2019-01-14 03:46:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 924 bytes |
コンパイル時間 | 1,630 ms |
コンパイル使用メモリ | 158,076 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 04:53:07 |
合計ジャッジ時間 | 3,203 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define max(a,b) ((a)>(b)?(a):(b)) #define min(a,b) ((a)<(b)?(a):(b)) #define abs(a) max((a),-(a)) #define rep(i,n) for(int i=0;i<(int)(n);i++) #define repe(i,n) rep(i,(n)+1) #define per(i,n) for(int i=(int)(n)-1;i>=0;i--) #define pere(i,n) rep(i,(n)+1) #define all(x) (x).begin(),(x).end() #define SP <<" "<< #define RET return 0 #define MOD 1000000007 #define INF 1000000000000000000 typedef long long LL; typedef long double LD; int main(){ int n; cin >> n; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(i<n/2){ if(j<n/2){ cout << (i*n/2+j)*2+1 << " "; }else{ cout << (i*n/2+n-j)*2-1+n*n/2 << " "; } }else{ if(j<n/2){ cout << ((i-n/2)*n/2+n/2-j)*2+n*n/2 << " "; }else{ cout << ((i-n/2)*n/2+j-n/2)*2+2 << " "; } } } cout << endl; } return 0; }