結果

問題 No.3010 Print inside /bin
ユーザー omuomu
提出日時 2015-05-04 02:26:36
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 4 ms / 1,500 ms
コード長 727 bytes
コンパイル時間 1,127 ms
コンパイル使用メモリ 70,916 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-19 06:39:51
合計ジャッジ時間 1,918 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <sys/types.h>
#include <dirent.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int main()
{ 
        DIR* dp=opendir("/bin");
        vector<string> v;
        if (dp!=NULL)
        {
                struct dirent* dent;
                do{
                        dent = readdir(dp);
                        if (dent!=NULL){
                                string t = dent->d_name;
                                if(t[0] != '.') v.push_back(t);
                        }
                 }while(dent!=NULL);
                closedir(dp);
        }
        sort(v.begin(),v.end());
        for(int i = 0;i < v.size();i++)cout << v[i] << endl;
        return 0;
}
0