자동AK기

4797 단어 폭력.

신기한 AK를 보러 왔습니다.


코드는 다음과 같다.

∑ni∑in 네, 이 업종은 쓸모가 없습니다.

#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;

string proname = "bread";//         

struct file_path
{
    string all;
    string path;
    string name;
};

bool TraverseFiles(string path,int &file_num,file_path file_name[],string fileme)
{
    _finddata_t file_info;
    string current_path=path+fileme; 
    int handle=_findfirst(current_path.c_str(),&file_info);
    if(-1==handle)
        return false;
    do
    {
        string attribute;
        if(file_info.attrib!=_A_SUBDIR)
        {
            file_name[file_num].all=path+"/"+file_info.name;
            file_name[file_num].name=file_info.name;
            file_name[file_num].path=path;
            file_num++;
        }

    }while(!_findnext(handle,&file_info));
    _findclose(handle);
    return true;
}

string ReadAll(string filepath)
{
    string str;
    ifstream fin;
    fin.open(filepath.data(), ios::in);
    stringstream buf;
    buf << fin.rdbuf(); 
    str = buf.str();
    fin.close();
    return str;
}

int main()
{
    freopen(string(proname+".out").data(),"w",stdout);
    int file_num=0;
    file_path file_name[100];
    TraverseFiles("../../data",file_num,file_name,"/*.in");
    TraverseFiles("../../data/"+proname,file_num,file_name,"/*.in");
    string indata=ReadAll(proname+".in");
    for(int i=0;iif(ReadAll(file_name[i].all)==indata)
        {
            string anspath;
            string in_name=file_name[i].name;
            char temp[100];
            file_name[i].name.copy(temp,file_name[i].name.length()-3,0);
            string ansname(temp);
            file_num=0;
            TraverseFiles(file_name[i].path,file_num,file_name,"/"+ansname+".*");
            for(int fs=0;fs!=file_num;fs++)
            {
                if(file_name[fs].name!=in_name)
                {
                    cout<return 0;
        }
    }
    return 0;
}

좋은 웹페이지 즐겨찾기