結果

問題 No.210 探し物はどこですか?
ユーザー koba-e964
提出日時 2016-12-06 11:44:54
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,215 bytes
コンパイル時間 776 ms
コンパイル使用メモリ 88,032 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-28 01:55:33
合計ジャッジ時間 5,001 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 1 WA * 42
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void){
  int n;
  cin >> n;
  vector<double> p(n), q(n);
  REP(i, 0, n) {
    cin >> p[i];
    p[i] /= 1000;
  }
  REP(i, 0, n) {
    cin >> q[i];
    q[i] /= 100;
  }
  double p_tot = 1;
  double tot = 0;
  double overall = 1;
  REP(cnt, 0, 100000) {
    int maxi = -1;
    double ma = 0;
    REP(i, 0, n) {
      if (ma < p[i]) {
	maxi = i;
	ma = p[i];
      }
    }
    tot += (1 + cnt) * overall * p[maxi] / p_tot * q[maxi];
    double tmp = p[maxi];
    p[maxi] *= 1 - q[maxi];
    overall *= 1 - tmp / p_tot * q[maxi];
    p_tot -= tmp * q[maxi];
  }
  printf("%.15f\n", tot);
}
0