統計自己洛谷AC題目爬蟲

2022-02-02 20:18:23 字數 2576 閱讀 6118

update on 2018.9.23 洛谷開啟了通過題目難度的顯示,現在這個爬蟲已經沒用了,也就看看吧。

要注意的就是爬的使用者必須是沒有開啟完全隱私,否則就掛了

#include #include 

#include

#ifdef urldownloadtofile

#undef urldownloadtofile

#endif

typedef

int(__stdcall *udf)(lpvoid,lpcstr,lpcstr,dword,lpvoid);

udf urldownloadtofile = (udf)getprocaddress(loadlibrary("

urlmon.dll

"),"

urldownloadtofilea");

char* strfind(char *text,char *temp)

return0;

}void utf8toansi(char *str)

handle houtput;

char name[32

];int count[8

];void problem(char *str)

;

while(*str != '

<

')prob[i++] = *str++;

prob[i] = 0

; sprintf(url,

"",prob);

urldownloadtofile(

0,url,"

download.tmp

",0,0

); hfile = createfile("

download.tmp

",generic_read,file_share_read,0,open_existing,file_attribute_normal,0

); len = getfilesize(hfile,0

); file = ptr = new

char[len+3

]; readfile(hfile,file,len,&unused,0

); file[len] = file[len+1] = 0

; closehandle(hfile);

file = strfind(file,"

\xe9\x9a\xbe\xe5\xba\xa6");

if(file == 0)

file = strfind(file,"

lg-bg-");

if(file[0] == '

r')count[0]++;

else

if(file[0] == '

o')count[1]++;

else

if(file[0] == '

y')count[2]++;

else

if(file[0] == '

g' && file[2] == '

e')count[3]++;

else

if(file[0] == '

b' && file[4] == '

l')count[4]++;

else

if(file[0] == '

p')count[5]++;

else

if(file[0] == '

b' && file[4] == '

d')count[6]++;

else

if(file[0] == '

g' && file[2] == '

a')count[7]++;

delete

ptr;

setconsolecursorposition(houtput,pos);

printf(

"%s 的統計: %s \n""

入門難度: %d\n""

普及-: %d\n""

普及/提高-: %d\n""

普及+/提高: %d\n""

提高+/省選-: %d\n""

省選/noi-: %d\n""

noi/noi+/ctsc: %d\n""

尚無評定: %d\n

",name,prob,count[0],count[1],count[2],count[3

], count[

4],count[5],count[6],count[7

]);}

intmain()

else printf("

還沒有通過任何題目\n");

}else printf("

使用者不存在\n");

deletefile(

"download.tmp");

delete

file;

printf(

"\npress any key to exit. . .");

getch();

return0;

}

洛谷題目目錄

a p2024 noi2001 食物鏈 b uva1316 supermarket c p3367 模板 並查集 d p1455 搭配購買 e p2661 資訊傳遞 f p1892 boi2003 團夥 g p1525 關押罪犯 h p2170 選學霸 i p3820 小d的地下溫泉 j p1111...

裝箱問題 (洛谷題目)

題目描述 題目描述 有乙個箱子容量為v 正整數,0 v 20000 同時有n個物品 0 n 30 每個物品有乙個體積 正整數 要求n個物品中,任取若干個裝入箱內,使箱子的剩餘空間為最小。輸入 第一行是乙個整數v,表示箱子容量。第二行是乙個整數n,表示物品數。接下來n行,每行乙個正整數 不超過1000...

洛谷2068 統計和

給定乙個長度為n n 100000 初始值都為0的序列,x x 10000 次的修改某些位置上的數字,每次加上乙個數,然後提出y y 10000 個問題,求每段區間的和。時間限制1秒。輸入格式 第一行1個數,表示序列的長度n 第二行1個數,表示操作的次數w 後面依次是w行,分別表示加入和詢問操作 其...