#pragma GCC optimize(3, "Ofast", "inline")
#include
using namespace std;
const int N = 2e5 + 10;
vector <pair <int, double> > z[N];
double dis[N];
int id[N];
bool inque[N];
int n, p, cc, m;
void spfa(int s)
{
memset (dis, 0x7f, sizeof dis);
dis[s] = 100;
queue <int> q;
q.push(s);
inque[s] = true;
while (q.size())
{
int f = q.front();
q.pop();
inque[f] = false;
for (auto &u : z[f])
if (dis[u.first] > dis[f] * 100. / (100. - u.second))
{
dis[u.first] = dis[f] * 100. / (100. - u.second);
if (!inque[u.first])
{
inque[u.first] = true;
q.push(u.first);
}
}
}
}
signed main()
{
cin >> n >> m;
for (int i = 1; i <= m; i ++)
{
int a, b, c;
cin >> a >> b >> c;
z[a].push_back(make_pair(b, c));
z[b].push_back(make_pair(a, c));
}
int a, b;
cin >> a >> b;
spfa(b);
printf ("%.8lf\n", dis[a]);
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53