結果
問題 | No.3010 Print inside /bin |
ユーザー | ぴろず |
提出日時 | 2015-05-04 00:02:05 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 636 bytes |
コンパイル時間 | 2,258 ms |
コンパイル使用メモリ | 76,460 KB |
実行使用メモリ | 56,432 KB |
最終ジャッジ日時 | 2023-09-19 05:43:46 |
合計ジャッジ時間 | 3,134 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
ソースコード
package no3010; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Process pr = Runtime.getRuntime().exec("ls ~/bin -F"); Scanner sc = new Scanner(pr.getInputStream()); ArrayList<String> lis = new ArrayList<>(); int count = 0; while(sc.hasNext()) { count++; String s = sc.next(); if (s.startsWith(".") || s.endsWith("/")) { continue; } lis.add(s); } if (count < 2) { throw new RuntimeException(); } Collections.sort(lis); for(String s: lis) { System.out.println(s); } } }