結果

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

ソースコード

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 600000
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;
	}
};
Prob p[1000];
double kitai[SHIKOU];
double ans;
int main() {
	D t;
	cin >> a;
	for (i = 0; i < a; i++) {
		cin >> p[i].p;
		p[i].p /= 1000.0;
	}
	for (i = 0; i < a; i++) {
		cin >> p[i].q;
		p[i].q /= 100.0;
	}
	for (i = 0; i < a; i++)
		p[i].r = p[i].p * p[i].q;
	sort(p, p + a);
	reverse(p, p + a);
	for (i = 0; i < SHIKOU; i++) {
		kitai[i] +=p[0].r;
		p[0].p *= 1.0 - p[0].q;
		p[0].r = p[0].p*p[0].q;
		for (j = 1; j < a; j++) {
			if (p[j - 1]<p[j])
				swap(p[j - 1], p[j]);
			else
				break;
		}
	}
	for (i = 0; i < SHIKOU; i++)
		ans += (double)i*kitai[i];
	printf("%.6f\n", ans+1);
}
0