#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
struct TreeNode{
vector<int> son;
int father;
};
int main(){
int N,M,L;
scanf("%d %d %d",&N,&M,&L);
TreeNode node[1010];
for(int i=0;i<1010;i++){
node[i].son.clear();
node[i].father = -1;
}
while(M--){
int a, b; //a->b
scanf("%d %d", &a, &b);
node[a].son.push_back(b);
node[b].father = a;
}
double ans = 1;
while(node[L].father != -1){
L = node[L].father;
ans *= 1.0 / node[L].son.size();
}
printf("%.6lf\n", ans);
return 0;
}
网友评论