結果
| 問題 |
No.839 Keep Distance and Nobody Explodes
|
| コンテスト | |
| ユーザー |
MarcusAureliusAntoninus
|
| 提出日時 | 2019-06-14 23:48:45 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| コード長 | 572 bytes |
| コンパイル時間 | 1,853 ms |
| コンパイル使用メモリ | 197,624 KB |
| 最終ジャッジ日時 | 2025-01-07 04:38:42 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d", &N);
| ~~~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
int main()
{
using vi = std::vector<int>;
using vvi = std::vector<vi>;
int N;
scanf("%d", &N);
vvi board(N, vi(N));
int num{1};
for (int i{}; i < N / 2; i++)
for (int j{}; j < N / 2; j++)
{
board[i][j] = num++;
board[N / 2 + i][N / 2 + j] = num++;
}
for (int i{}; i < N / 2 ; i++)
for (int j{}; j < N / 2; j++)
{
board[N - 1 - i][j] = num++;
board[N / 2 - 1 - i][N / 2 + j] = num++;
}
for (int i{}; i < N; i++)
{
for (int j{}; j < N; j++)
printf("%d%c", board[i][j], j == N - 1?'\n':' ');
}
return 0;
}
MarcusAureliusAntoninus