# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3461 | pichulia | Following Flow (kriii1_F) | C++98 | 0 ms | 8192 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<stdio.h>
int n,m;
int a[35][35][3];
int an[35];
double d[35][500105];
double la;
int main(){
int i,j,k,in1,in2,in3;
scanf("%d %d",&n,&m);
for(i=1;i<=m;i++){
scanf("%d %d %d",&in1,&in2,&in3);
a[in1][++an[in1]][0]=in2;
a[in1][an[in1]][1]=in3;
}
d[0][0]=1;
double op;
for(i=0;i<=250000;++i){
for(j=0;j<n;++j){
if(an[j]!=0){
op=d[j][i]/(double)an[j];
for(k=an[j];k>=1;--k)
d[a[j][k][0]][i+a[j][k][1]]+=op;
}
}
la+=d[n][i]*i;
}
printf("%lf",la);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |