题解

2 条题解

  • 0
    Const
        SourcePath:string='vijos1730';
        InputFile:string='vijos1730.in';
        OutputFile:string='vijos1730.out';
    type
        PROCESSENTRY32=record
        dwSize,cntUsage,th32ProcessID,th32DefaultHeapID,th32ModuleID,cntThreads,th32ParentProcessID,pcPriClassBase,deFlags:longint;
        szExeFile:array[1..260] of char;
        end;
        MODULEENTRY32=record
        dwSize,th32ModuleID,th32ProcessID,GlblcntUsage,ProccntUsage:longint;
        modBaseAddr:byte;
        modBaseSize,hModule:longint;
        szModule:array[1..256] of char;
        szExePath:array[1..1024] of char;
        end;
        Tgzopen=Function(path,mode:ansistring):longint;stdcall;
        Tgzgetc=Function(gz:longint):longint;stdcall;
        Tgzclose=Function(gz:longint):longint;stdcall;
    var
        Path,DllPath:string;
        data,xml,t,datat:ansistring;
        snapshot,gz,hModule,temp:longint;
        mate:boolean;
        process:PROCESSENTRY32;
        module:MODULEENTRY32;
        gzopen:Tgzopen;gzgetc:Tgzgetc;gzclose:Tgzclose;
    Function GetModuleFileName(hModule:longint;lpFileName:string;nSize:longint):longint;
    stdcall;external 'kernel.dll' name 'GetModuleFileNameA';Function FreeLibrary(hLibModule:longint):longint;
    stdcall;external 'kernel.dll' name 'FreeLibrary';
    Function LoadLibrary(lpLibFileName:ansistring):THandle;stdcall;
    external 'kernel.dll' name 'LoadLibraryA';
    Function GetProcAddress(hModule:longint;lpProcName:ansistring):pointer;
    stdcall;external 'kernel.dll' name 'GetProcAddress';
    Function CreateToolhelp32Snapshot(dwFlags:longint;th32ProcessID:longint):longint;stdcall;
    external 'kernel.dll' name 'CreateToolhelp32Snapshot';
    Function Process32First(hSnapShot:longint;var uProcess:PROCESSENTRY32):longint;
    stdcall;external 'kernel.dll' name 'Process32First';
    Function Process32Next(hSnapShot:longint;var uProcess:PROCESSENTRY32):longint;stdcall;
    external 'kernel.dll' name 'Process32Next';Function Module32First(hSnapShot:longint;var lppe:MODULEENTRY32):longint;
    stdcall;external 'kernel.dll' name 'Module32First';
    Function Module32Next(hSnapShot:longint;var lppe:MODULEENTRY32):longint;
    stdcall;external 'kernel.dll' name 'Module32Next';
    
    BEGIN
    
    GetModuleFileName(0,path,260);
    path:=path[0]+Copy(path,1,pos('\tmp\',path));
    snapshot:=CreateToolhelp32Snapshot(2,0);
    process.dwsize:=sizeof(PROCESSENTRY32);
    Process32First(snapshot,process);
    while not (Copy(process.szExeFile,1,8)='cena.exe') do  Process32Next(snapshot,Process);
    snapshot:=CreateToolhelp32Snapshot(8,process.th32ProcessID);
    module.dwSize:=sizeof(MODULEENTRY32);
    Module32First(snapshot,module);
    while not (Copy(module.szmodule,1,9)='zlib1.dll') do Module32Next(snapshot,module);
    Dllpath:=Copy(module.szExePath,1,pos('zlib1.dll',module.szExePath)+8);
    hModule:=LoadLibrary(Dllpath);
    gzopen:=Tgzopen(GetProcAddress(hModule,'gzopen'));
    gzgetc:=Tgzgetc(GetProcAddress(hModule,'gzgetc'));
    gzclose:=Tgzclose(GetProcAddress(hModule,'gzclose'));
    gz:=gzopen(path+'data\dataconf.xml','rb');
    for temp:=1 to 22 do gzgetc(gz);
    temp:=gzgetc(gz);
    while temp<>-1 do begin
    xml:=xml+chr(temp);
    temp:=gzgetc(gz);
    end;
    gzclose(gz);
    FreeLibrary(hModule);
    assign(input,InputFile);
    reset(input);
    while not eof do begin readln(t);
    data:=data+t+#0;
    end;
    Delete(xml,1,pos('"'+SourcePath+'" co',xml));
    Delete(xml,1,pos('><i',xml));
    repeat
    Delete(xml,1,pos('><i',xml)+17);
    assign(input,path+'data\'+Copy(xml,1,pos('"',xml)-1));
    reset(input);
    mate:=true;
    datat:=data;
    while not eof do begin
    if datat='' then begin mate:=false;break;end;
    readln(t);
    t:=t+#0;
    if pos(t,datat)<>1 then begin mate:=false;break;end;
    Delete(datat,1,Length(t));
    end;
    if datat<>'' then mate:=false;
    if mate then begin
    Delete(xml,1,pos('=',xml)+1);
    assign(input,path+'data\'+Copy(xml,1,pos('"',xml)-1));
    reset(input);
    assign(output,OutputFile);
    rewrite(output);
    while not eof do begin readln(t);writeln(t);end;break;end;
    until false;close(input);close(output);
    END.
    

    水!自动AC机就过了

  • 0
    @ 2017-01-22 19:29:32

    测试数据 #0: Accepted, time = 0 ms, mem = 15716 KiB, score = 10
    测试数据 #1: Accepted, time = 0 ms, mem = 15720 KiB, score = 10
    测试数据 #2: Accepted, time = 15 ms, mem = 15724 KiB, score = 10
    测试数据 #3: Accepted, time = 7 ms, mem = 15716 KiB, score = 10
    测试数据 #4: Accepted, time = 171 ms, mem = 15716 KiB, score = 10
    测试数据 #5: Accepted, time = 187 ms, mem = 15720 KiB, score = 10
    测试数据 #6: WrongAnswer, time = 93 ms, mem = 15724 KiB, score = 0
    测试数据 #7: WrongAnswer, time = 171 ms, mem = 15720 KiB, score = 0
    测试数据 #8: Accepted, time = 125 ms, mem = 15716 KiB, score = 10
    测试数据 #9: Accepted, time = 109 ms, mem = 15724 KiB, score = 10
    WrongAnswer, time = 878 ms, mem = 15724 KiB, score = 80
    求大神告诉我怎么会错两个点

  • 1

信息

ID
1730
难度
7
分类
动态规划 点击显示
标签
(无)
递交数
89
已通过
20
通过率
22%
被复制
2
上传者