結果
問題 | No.1130 Grid Numbers |
ユーザー | yuki |
提出日時 | 2020-08-20 01:02:50 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 164 ms / 2,000 ms |
コード長 | 845 bytes |
コンパイル時間 | 2,183 ms |
コンパイル使用メモリ | 77,076 KB |
実行使用メモリ | 42,036 KB |
最終ジャッジ日時 | 2024-04-20 16:21:52 |
合計ジャッジ時間 | 4,818 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 135 ms
41,400 KB |
testcase_01 | AC | 139 ms
41,144 KB |
testcase_02 | AC | 136 ms
41,804 KB |
testcase_03 | AC | 132 ms
41,168 KB |
testcase_04 | AC | 119 ms
40,016 KB |
testcase_05 | AC | 138 ms
42,028 KB |
testcase_06 | AC | 136 ms
41,268 KB |
testcase_07 | AC | 138 ms
41,276 KB |
testcase_08 | AC | 145 ms
41,664 KB |
testcase_09 | AC | 154 ms
41,692 KB |
testcase_10 | AC | 164 ms
42,036 KB |
testcase_11 | AC | 155 ms
41,608 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); int height = in.nextInt(); int width = in.nextInt(); List<Integer> list = new ArrayList<>(); // insert input into List for(int i=0; i<height; i++){ for(int j=0; j<width; j++){ int num = in.nextInt(); list.add(num); Collections.sort(list); } } // output list for(int i=0; i<width*height; i++){ System.out.print(list.get(i)); System.out.print(" "); // iがwidthの倍数になると、改行する if(((i+1) % width) == 0){ System.out.println(""); } } } }