結果

問題 No.3010 Print inside /bin
ユーザー くれちーくれちー
提出日時 2016-12-27 16:56:24
言語 C90
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 533 bytes
コンパイル時間 739 ms
コンパイル使用メモリ 24,072 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-08-21 14:55:58
合計ジャッジ時間 2,073 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>

int comp(const void *a, const void *b) {
	return strcmp((char *)a, (char *)b);
}

int main(void) {
	DIR *dir;
	struct dirent *dp;
	dir = opendir("/bin");

	char list[256][64];
	int cnt = 0;
	for (dp = readdir(dir); dp != NULL; dp = readdir(dir)) {
		char *t = dp -> d_name;
		if (t[0] != '.') strcpy(list[cnt++], t);
	}
	closedir(dir);

	qsort(list, cnt, sizeof(char) * 64, comp);
	int i;
	for (i = 0; i < cnt; i++) printf("%s\n", list[i]);
	return 0;
}
0