百度之星趣味赛——AK咆哮体

模仿ACM的知识问答

最近忙于考试、比赛没有时间好好写

 

完整文件下载(包括题目数据)

http://download.csdn.net/source/3315320

//astar.cpp

#include"astar.h" int main() { char c; init(); while(1) { print(); c=getch(); switch(c) { case '1':OI();break; case '2':ACM();break; case '3':TC();break; case '4':Astar();break; case 'q': case 'Q':exit(0); default:other(); } } }

 

 

//astar.h

#include<cstdio> #include<cstring> #include<cstdlib> #include<ctime> #include<conio.h> #include<windows.h> #define CMD system char menustr[]={-57,-21,-47,-95,-44,-15,-60,-93,-54,-67,58,10,49,46,79,73,10,50,46,65,67,77,10,51,46,84,67,10,52,46,65,115,116,97,114,0}; char oistr[]={79,73,-61,-69,-72,-29,-71,-3,-80,-95,44,-78,-69,-42,-86,-75,-64,-44,-11,-61,-76,-72,-29,-80,-95,33,33,33,33,33,0}; char acmstr[]={-70,-61,-80,-55,44,-65,-86,-54,-68,65,-52,-30,-80,-55,126,126,126,0}; char acmstr1[]={-60,-29,-49,-21,-52,-31,-67,-69,-60,-60,-72,-10,-52,-30,63,0}; char acmstr2[]={-61,-69,-45,-48,-43,-30,-72,-10,-52,-30,-80,-95,33,33,33,33,33,0}; char astarstr[]={-79,-56,-56,-4,-69,-71,-61,-69,-65,-86,-54,-68,44,-45,-48,-60,-66,-45,-48,-80,-95,33,33,33,33,33,10,-75,-56,-75,-67,54,-44,-62,49,49,-70,-59,-75,-60,-60,-51,-48,-60,-45,-48,-60,-66,-45,-48,-80,-95,33,33,33,33,33,0}; char tcstr[]={65,67,77,-41,-10,-69,-31,-63,-53,-44,-39,-64,-76,-51,-26,84,67,-80,-95,33,33,33,33,33,-73,-15,-44,-14,-60,-29,-55,-53,-78,-69,-58,-16,-80,-95,33,33,33,33,33,0}; char otherstr[]={-60,-29,-44,-11,-61,-76,-60,-36,-62,-46,-47,-95,-60,-40,33,33,33,33,33,-42,-86,-78,-69,-42,-86,-75,-64,-60,-66,-45,-48,-43,-30,-72,-10,-47,-95,-49,-18,-80,-95,33,33,33,33,33,0}; char filestr[]={-43,-46,-78,-69,-75,-67,-54,-3,-66,-35,-50,-60,-68,-2,-80,-95,33,33,33,33,33,0}; char problem[2][505][225],ans[505][3]; clock_t s_time,e_time,t_time,c_time; FILE *fp; int total,num,submit,solved,p[15]; struct problem { int id,time,submit,solved; }pro[15]; void init() { total=0; fp=fopen("d://data//problems.txt","r");// if(fp==NULL) { puts(filestr); exit(0); } while(fgets(problem[0][total],225,fp)) { fgets(problem[1][total],225,fp); fgets(ans[total++],3,fp); } } void color(int n) { char s[15]={99,111,108,111,114,32,0},t[5]; sprintf(t,"%X",n); strcat(s,t); CMD(s); } int start() { srand(clock()*123456789); num=rand()%5+6; submit=0; solved=0; memset(pro,0,sizeof(pro)); s_time=clock(); c_time=num/2*1000*60; } int AK(); int end(char *s=NULL) { int i; if(s!=NULL) { puts(s); Sleep(1000); } printf("Submissions:%d/nSolved:%d/n",submit,solved); for(i=0;i<num;i++) { printf("problem %c ",i+'A'); if(pro[i].solved) printf("AC "); else printf("-- "); if(pro[i].solved) printf("%6d ",pro[i].time); else printf("------ "); printf("%d/n",pro[i].submit); } Sleep(2000); if(solved==num) AK(); system("pause"); } int id_ok(int id) { if(id<1||id>num) return 0; if(pro[id-1].solved) { puts("你已经AC了啊!!!!!还想提交啊?????"); Sleep(500); } return 1; } int judge(int id,char *s) { submit++; int t=p[id]; pro[id].submit++; if(!strcmpi(s,ans[t])||!s[1]&&s[0]==ans[t][0]-'A'+'1') { if(!pro[id].solved) { solved++; pro[id].solved=1; pro[id].time=clock()-s_time; } return 0; } return rand()%8+1; } int AC(int id) { char s[][55]={"AC!!!!!","你竟然把神题AC了!!!!!","AC...这题确实水啊!!!!!","这么水的题,现在才AC啊!!!!!","你又AC了一个水题啊!!!!!"}; puts(s[rand()%5]); } int WA(int id) { char s[][55]={"WA!!!!!","神题当然WA了!!!!!","WA...这题很水啊!!!!!","这么水的题,还在WA啊!!!!!","你又WA了啊!!!!!"}; puts(s[rand()%5]); } int TLE(int id) { puts("TLE。。。你要提高效率啊!!!!!"); } int MLE(int id) { puts("MLE...你少用点内存行不行啊!!!!!"); } int CE(int id) { puts("CE...你答的什么呢?????坑爹啊!!!!!"); } int PE(int id) { puts("PE...你离AC很接近了加油啊!!!!!"); } int RE(int id) { puts("RE...运行时出错了啊!!!!你是不是越界了啊!!!!!"); } int SE(int id) { puts("SE...系统错误。。。"); } int OT(int id) { puts("我也不知道是什么结果。。。什么啊!!!!!坑爹啊!!!!!"); } int AK() { puts("你竟然AK了啊!!!!!有木有啊!!!!!"); color(1); Sleep(2000); puts("我造数据很辛苦啊!!!!!有木有啊!!!!!"); color(2); Sleep(2000); puts("我以为是神题啊!!!!!有木有啊!!!!!"); color(3); Sleep(2000); puts("我以为木有人能AK啊!!!!!有木有啊!!!!!"); color(4); Sleep(2000); puts("难道我数据造水了啊!!!!!有木有啊!!!!!"); color(5); Sleep(2000); puts("你不知道我数据很BT啊!!!!!有木有啊!!!!!"); color(6); Sleep(1500); puts("你竟然也敢提交啊!!!!!有木有啊!!!!!"); color(7); Sleep(2000); puts("你AK不给我面子啊!!!!!有木有啊!!!!!"); color(8); Sleep(2000); color(9); printf("从此以后再也不出题了"); for(int i=0;i<5;i++) { Sleep(1000); putchar('.'); } puts(""); Sleep(2000); puts("难道你就是传说中的WSN啊!!!!!"); Sleep(2000); puts("/n恭喜你AK了啊!!!!!"); color(10); return 0; } int result() { puts("比赛结束了啊!!!!!不能再提交了啊!!!!!"); Sleep(1000); end(); return 0; } void print(char *str=NULL) { fflush(stdin); char s[]={99,108,115,0}; CMD(s); color(7); puts(menustr); } int OI() { puts(oistr); color(2); Sleep(3000); return 0; } bool check() { e_time=clock(); if(e_time-s_time>c_time) { result(); return 1; } return 0; } int ACM() { start(); puts(acmstr); int i,t,id,f[505]={0}; char s[5]; for(i=0;i<num;) { id=(rand()*num+rand()*i)%total; if(!f[id]) { f[id]=1; p[i++]=id; } } while(1) { printf("%s(1-%d)/n",acmstr1,num); if(check())break; scanf("%s",s); if(s[0]=='q'||s[0]=='Q'){end();return 0;} sscanf(s,"%d",&id); if(check())break; if(id_ok(id)) { t=p[--id]; puts(problem[0][t]); puts(problem[1][t]); scanf("%s",s); if(s[0]=='q'||s[0]=='Q'){continue;} switch(judge(id,s)) { case 0:AC(id);break; case 1:WA(id);break; case 2:TLE(id);break; case 3:MLE(id);break; case 4:CE(id);break; case 5:PE(id);break; case 6:RE(id);break; case 7:SE(id);break; default:OT(id); }; } else { puts(acmstr2); } } return 0; } int TC() { puts(tcstr); Sleep(2500); return 0; } int Astar() { putchar(7); puts(astarstr); Sleep(3000); return 0; } int other() { color(10); putchar(7); puts(otherstr); Sleep(1500); return 0; }

 

 

 

你可能感兴趣的:(struct,百度,cmd,null,System,FP)