ACM试题(3)

2019-08-30 15:16

bool getPosition(char ch,pNode p) {

for (int i=0;i

for (int j=0;j

if (map[i][j]==ch) {

p->x=i; p->y=j; return true; } } }

return false; }

float escape(char *revs,int len_revs,int time,Andy andy) {

int i,j;

int tempTime; float max=-1; float temp;

Node path[MAX_MAP_SIZE*MAX_MAP_SIZE]; int len_path=1; Andy newAndy; bool flag;

for (i=0;i<4+M;i++) {

flag=false;

for (j=1;j

if (revs[j]==keywords[i]) {

flag=true; break; } }

if (flag) {

continue; }

getPosition(revs[len_revs-1],path);

tempTime=shortestPath(path,len_path,keywords[i],revs,len_revs,time);

if (tempTime>0) {

if (keywords[i]=='E') //ÕÒµ½³ö¿Ú {

temp=(float)andy.p/(Time-time+tempTime);

/*cout<

cout<

cout<

{

if (keywords[i]=='A') {

newAndy.p=andy.p+P; newAndy.q=andy.q; newAndy.r=andy.r;

}

else if (keywords[i]=='B') {

newAndy.p=andy.p; newAndy.q=andy.q+Q; newAndy.r=andy.r; }

else if (keywords[i]=='C') {

newAndy.p=andy.p; newAndy.q=andy.q; newAndy.r=andy.r+R; }

else //ÔâÓö¹ÖÊÞ {

pMonster pMon=mons+keywords[i]-'0';

if (andy.qr) {

newAndy.p=-1; //¸ù±

¾¹ý²»È¥£¬¹ÖÊ޵ķÀÓùÌ«¸ß }

else if (pMon->q

ºÜ¸ß£¬¶ø²»»áËðʧÄÜÁ¿ {

newAndy.p=andy.p;

} else {

newAndy.p=andy.p-(pMon->q-andy.r)*(pMon->p/(andy.q-pMon->r)); }

newAndy.q=andy.q; newAndy.r=andy.r; }

revs[len_revs]=keywords[i];

temp=escape(revs,len_revs+1,time-tempTime,newAndy); }

max=max>temp? max:temp; } }

return max; }


ACM试题(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:黑白照片冲洗放大报告

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: