| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
wa得受不了,用别人A了的程序在本机上和自己的程序对比,随机了几十万组数据,结果都一样!!!附代码,求高人给组数据证明我程序是错的!
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "math.h"
const int nlen=102;
bool bgRate[nlen][nlen];
struct Station{
int a,b;
double rab,rba,cab,cba;
};
Station sgchg[nlen];
int N,M,S;
double fgMark[nlen],V;
bool fnDSF(int cury,double amt){
int next;
double famt;
if(amt<=0)
return false;
if(fgMark[cury]==0)
fgMark[cury]=amt;
else if(fgMark[cury]!=0&&fgMark[cury]<amt)
return true;
else return false;
for(int i=1;i<=M;i++){
if(bgRate[cury][i])
continue;
if(cury==sgchg[i].a){
next=sgchg[i].b;
famt=(amt-sgchg[i].cab)*sgchg[i].rab;
}
else{
next=sgchg[i].a;
famt=(amt-sgchg[i].cba)*sgchg[i].rba;
}
if(fnDSF(next,famt))
return true;
}
fgMark[cury]==0;
return false;
}
int main(){
memset(bgRate,true,sizeof(bgRate));
scanf("%d%d%d%lf",&N,&M,&S,&V);
for(int i=1;i<=M;i++){
scanf("%d%d%lf%lf%lf%lf",&sgchg[i].a,&sgchg[i].b,&sgchg[i].rab,&sgchg[i].cab,&sgchg[i].rba,&sgchg[i].cba);
bgRate[sgchg[i].a][i]=false;
bgRate[sgchg[i].b][i]=false;
}
memset(fgMark,0,sizeof(fgMark));
if(fnDSF(S,V))
printf("YES\n");
else
printf("NO\n");
//system("pause");
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator