結果
| 問題 | No.839 Keep Distance and Nobody Explodes |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-06-15 04:15:30 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 627 ms / 2,000 ms |
| コード長 | 811 bytes |
| コンパイル時間 | 1,953 ms |
| コンパイル使用メモリ | 79,396 KB |
| 実行使用メモリ | 55,096 KB |
| 最終ジャッジ日時 | 2024-11-16 19:38:44 |
| 合計ジャッジ時間 | 14,743 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
new Main().run();
}
void run() {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[][] ans = new int[N][N];
for (int i = 0; i < N / 2; ++i) {
for (int j = 0; j < N / 2; ++j) {
ans[i][j] = 2 * i * (N / 2) + 2 * j + 1;
ans[i + N / 2][j + N / 2] = ans[i][j] + 1;
ans[i][N - 1 - j] = ans[i][j] + 2 * (N / 2) * (N / 2);
ans[i + N / 2][N / 2 - 1 - j] = ans[i + N / 2][j + N / 2] + 2 * (N / 2) * (N / 2);
}
}
for (int i = 0; i < N; ++i) {
for (int j = 0; j < N; ++j) {
System.out.print(ans[i][j] + (j == N - 1 ? "\n" : " "));
}
}
}
void tr(Object... objects) {
System.out.println(Arrays.deepToString(objects));
}
}