結果
問題 |
No.298 話の伝達
|
ユーザー |
![]() |
提出日時 | 2015-11-07 00:17:38 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 845 bytes |
コンパイル時間 | 661 ms |
コンパイル使用メモリ | 66,960 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-13 13:17:58 |
合計ジャッジ時間 | 1,346 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 11 |
ソースコード
#include<iostream> #include<string> #include<list> #include<map> #include<vector> #include<stack> #include<cstdint> #include<sstream> #include<numeric> #define INT int struct Group { INT a; INT b; INT c; }; using namespace std; int main() { INT n, m; INT i, j, k; Group gr[190]; double pr[20]; fill(pr, pr + 20, 1000.0); cin >> n >> m; for (i = 0; i < m; i++) { auto &z = gr[i]; cin >> z.a >> z.b >> z.c; } pr[0] = 1.0; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (pr[j] == 1000.0) { bool f = true; double t = 0.0; for (k = 0; k < m; k++) { if (gr[k].b == j) { if (pr[gr[k].a] != 1000.0) { t +=(1.0-t)*pr[gr[k].a] * ((double)gr[k].c / 100.0); } else { f = false; } } } if (f) { pr[j] = t; } } } } printf("%.14f\n", pr[n - 1]); }