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 |
AC (/≧▽≦)/(忘记删掉调试信息WA了无数次o(╥﹏╥)o)#include<iostream> #include<stdio.h> #include<stdlib.h> #include<algorithm> #include<string.h> #include<map> #include<math.h> #include<vector> #include<queue> #include<stack> #define inf 99999999 using namespace std; int n,m,a,b,c,cnt; double d[110]; struct edge { int a,b; double p; }e[11000]; void adde(int a,int b,double p) { e[cnt].a=a; e[cnt].b=b; e[cnt++].p=p; } int main() { while(cin>>n)//n点m边 { if(!n)return 0; cin>>m; cnt=1; for(int i=1;i<=m;i++) { scanf("%d%d%d",&a,&b,&c); adde(a,b,c/100.0); adde(b,a,c/100.0); } memset(d,0,sizeof(d)); d[1]=1; for(int i=1;i<n;i++) for(int j=1;j<cnt;j++) d[e[j].b]=max(d[e[j].b],d[e[j].a]*e[j].p); printf("%.6f percent\n",d[n]*100); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator