結果
| 問題 | No.1130 Grid Numbers |
| ユーザー |
tenten
|
| 提出日時 | 2020-08-17 22:56:12 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 139 ms / 2,000 ms |
| コード長 | 546 bytes |
| 記録 | |
| コンパイル時間 | 2,260 ms |
| コンパイル使用メモリ | 74,796 KB |
| 実行使用メモリ | 41,420 KB |
| 最終ジャッジ日時 | 2024-10-11 11:29:16 |
| 合計ジャッジ時間 | 4,515 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
import java.util.*;
public class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int h = sc.nextInt();
int w = sc.nextInt();
int[] arr = new int[h * w];
for (int i = 0; i < h * w; i++) {
arr[i] = sc.nextInt();
}
Arrays.sort(arr);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < h * w; i++) {
if (i % w > 0) {
sb.append(" ");
}
sb.append(arr[i]);
if (i % w == w - 1) {
sb.append("\n");
}
}
System.out.print(sb);
}
}
tenten