2 条题解
-
1VIJOS管理员----AFOer_LBW (超级牛逼卢本伟1号) LV 10 @ 2021-07-19 16:20:00
牛马题,不就是a+b吗
-
02021-07-19 16:23:26@
Const
SourcePath:string='incantation';
InputFile:string='incantation.in';
OutputFile:string='incantation.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就vans了
- 1