結果

問題 No.3012 Catch C code
ユーザー Lay_ecLay_ec
提出日時 2015-09-01 05:17:20
言語 Text
(cat 8.3)
結果
AC  
実行時間 2 ms / 1,500 ms
コード長 759 bytes
コンパイル時間 50 ms
コンパイル使用メモリ 5,216 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-09-25 21:38:13
合計ジャッジ時間 1,046 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <fstream>
#include <dirent.h>
using namespace std;

int main(){
    
    DIR* dir=opendir("./");
    
    dirent* ent;
    string name;
    while(ent=readdir(dir),ent!=NULL){
        name=string(ent->d_name);
        if(name[name.size()-2]=='.' && name[name.size()-1]=='o') break;
    }
    
    ifstream ifs(name.c_str(),ios::binary);
    
    char c1,c2,c3,c4,c5;
        
    ifs>>c1>>c2>>c3>>c4;
    while(!ifs.eof()){
        ifs>>c5;
        if(c1=='F' && c2=='L' && c3=='A' && c4=='G' && c5=='_'){
            cout<<"FLAG_";
            char c;
            while(ifs>>c , c!=0) cout<<c;
            cout<<endl;
            return 0;
        }
        c1=c2; c2=c3; c3=c4; c4=c5;
    }
    
    return 0;
}
0