結果
問題 |
No.1173 Endangered Species
|
ユーザー |
![]() |
提出日時 | 2020-04-29 02:01:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 242 ms / 2,000 ms |
コード長 | 554 bytes |
コンパイル時間 | 2,769 ms |
コンパイル使用メモリ | 195,980 KB |
最終ジャッジ日時 | 2025-01-10 03:13:17 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep2(i, m, n) for(int i=int(m); i<int(n); ++i) #define rep(i, n) rep2(i, 0, n) using ld = long double; using V = vector<int>; using Vld = vector<ld>; int main() { int n; cin >> n; Vld p(n), q(n); V a(n); rep(i, n) cin >> p[i]; rep(i, n) cin >> q[i]; rep(i, n) cin >> a[i]; ld y = 0; rep(i, 100) { ld f = 0; rep(i, n) f += p[i] * (1-q[i]) / (1-q[i]*y); y = f; } ld ans = 0; rep(i, n) ans += a[i] * log((1-q[i]) / (1-q[i]*y)); cout << ans << endl; return 0; }