結果

問題 No.3010 Print inside /bin
ユーザー ぴろずぴろず
提出日時 2015-05-04 00:18:45
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 813 bytes
コンパイル時間 2,458 ms
コンパイル使用メモリ 75,228 KB
実行使用メモリ 56,444 KB
最終ジャッジ日時 2023-09-19 05:49:56
合計ジャッジ時間 3,341 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package no3010;

import java.io.InputStream;
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");
		InputStream is = pr.getInputStream();
		StringBuilder sb = new StringBuilder();
		ArrayList<String> lis = new ArrayList<>();
		try {
			while(true) {
				int c = is.read();
				if (c < 0) {
					break;
				}
				sb.appendCodePoint(c);
			}
		}finally{
			is.close();
		}
		String input = sb.toString();
		Scanner sc = new Scanner(input);
		while(sc.hasNext()) {
			String s = sc.next();
			if (!s.startsWith(".") && !s.endsWith("/")) {
				lis.add(s);
			}
		}
		Collections.sort(lis);
		for(String s: lis) {
			System.out.println(s);
		}
	}

}
0