結果
問題 |
No.210 探し物はどこですか?
|
ユーザー |
|
提出日時 | 2016-02-18 12:03:10 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 669 bytes |
コンパイル時間 | 573 ms |
コンパイル使用メモリ | 62,120 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-22 11:55:43 |
合計ジャッジ時間 | 10,460 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 WA * 12 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:19:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%lf", &p[i]); | ~~~~~^~~~~~~~~~~~~~ main.cpp:23:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 23 | scanf("%lf", &q[i]); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#define _CRT_SECURE_NO_WARNINGS #include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> #include<iostream> #include<vector> #include<queue> using namespace std; const int maxn = 2e5; double p[1005], dp[1005],q[1005]; int n; double v(int x){ return p[x] * (1 - dp[x]) * q[x]; } int main(){ cin >> n; for (int i = 0; i < n; i++){ scanf("%lf", &p[i]); p[i] /= 1e3; } for (int i = 0; i < n; i++){ scanf("%lf", &q[i]); q[i] /= 1e2; } double g = 0; for (int i = 1; i < maxn; i++){ int x = 0; for (int j = 0; j < n; j++){ if (v(x) < v(j)) x = j; } g += i * v(x); dp[x] += (1 - dp[x]) * q[x]; } printf("%.7lf\n", g); return 0; }