結果
問題 |
No.8018 簡易版ページランク
|
ユーザー |
|
提出日時 | 2022-03-03 03:24:36 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 703 bytes |
コンパイル時間 | 4,404 ms |
コンパイル使用メモリ | 254,956 KB |
最終ジャッジ日時 | 2025-01-28 04:21:39 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include<bits/stdc++.h> using namespace std; #include<atcoder/all> using namespace atcoder; using ll = long long; double dp[101][1000]; int n,m; vector<vector<pair<int,double>>> G; void solve(){ for(int i = 0;i<n;i++){ dp[0][i] = 10; } for(int i =0;i<100;i++){ for(int j = 0;j<n;j++){ double sum = 0; for(auto &[to,w]:G[j]){ sum += w; } for(auto &[to,w]:G[j]){ dp[i+1][to] += dp[i][j]*w/sum; } } } for(int i = 0;i<n;i++){ printf("%.10lf\n",dp[100][i]); } } signed main(){ cin.tie(nullptr); ios::sync_with_stdio(false); cin >> n >> m; G.resize(n); for(int i = 0 ;i<m;i++){ int a,b; double d; cin >> a >> b >> d; G[a].emplace_back(b,d); } solve(); }