結果

問題 No.210 探し物はどこですか?
ユーザー 唐澤貴洋
提出日時 2015-10-15 23:09:01
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 621 ms / 2,000 ms
コード長 1,127 bytes
コンパイル時間 575 ms
コンパイル使用メモリ 74,628 KB
実行使用メモリ 27,264 KB
最終ジャッジ日時 2024-07-21 16:40:10
合計ジャッジ時間 16,896 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<bitset>
#include<array>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstdlib>
#include<numeric>
#define D long long
#define U unsigned
#define SHIKOU 3000000
using namespace std;
D n, m,a, b, d, e, x, y, z;
D i, j, k;
char c,f;
string s;
struct Prob {
	double p;
	double q;
	double r;
	bool operator<(const Prob &obj)const {
		return r < obj.r;
	}
	bool operator>(const Prob &obj)const {
		return r > obj.r;
	}
};
double kitai[SHIKOU];
double ans;
int main() {
	D t;
	priority_queue<Prob> p;
	Prob tmp[1000],tm;
	cin >> a;
	for (i = 0; i < a; i++) {
		cin >> tmp[i].p;
		tmp[i].p /= 1000.0;
	}
	for (i = 0; i < a; i++) {
		cin >> tmp[i].q;
		tmp[i].q /= 100.0;
	}
	for (i = 0; i < a; i++)
		tmp[i].r = tmp[i].p * tmp[i].q;
	for (i = 0; i < a; i++)
		p.push(tmp[i]);
	for (i = 0; i < SHIKOU; i++) {
		tm = p.top();
		p.pop();
		kitai[i] +=tm.r;
		tm.p *= 1.0 - tm.q;
		tm.r = tm.p*tm.q;
		p.push(tm);
	}
	for (i = 0; i < SHIKOU; i++)
		ans += (double)i*kitai[i];
	printf("%.6f\n", ans+1);
}
0