結果

問題 No.1993 Horse Racing
ユーザー ChocolateCornetChocolateCornet
提出日時 2022-07-07 20:55:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 4,096 bytes
コンパイル時間 1,535 ms
コンパイル使用メモリ 169,132 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 08:06:36
合計ジャッジ時間 3,003 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//#include <bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for(int i=0;i<n;++i)
using Graph = vector<vector<int>>;
ll MAX(ll x, ll y) {
    if (x >= y)return x;
    else return y;
}
ll MIN(ll x, ll y) {
    if (x >= y)return y;
    else return x;
}
ll gcd(ll x, ll y) {
    if (x < y)swap(x, y);
    if (y == 0)return x;
    return gcd(y, x % y);
}//最大公約数
ll lcm(ll a, ll b) {
    return (a / gcd(a, b)) * b;
}//最小公倍数
ll one_to_k(ll K) {
    return K * (K + 1) / 2;
}//1~Kまでの和
vector<pair<ll, ll>> prime_factorize(ll N) {
    vector<pair<ll, ll>>res;
    for (ll a = 2; a * a <= N; a++) {
        if (N % a != 0)continue;
        ll ex = 0;
        while (N % a == 0) {
            ex++;
            N /= a;
        }
        res.push_back({ a,ex });
    }
    if (N != 1)res.push_back({ N,1 });
    return res;
}//素因数分解O(√N)(素因数,指数)のpairの配列生成
//const auto &res = prime_factorize(N);
const ll INF = 7000000000000000000;
const ll inf = 1000000000 + 7;
ll MOD = 998244353;
// 定数
bool IsPrime(ll num) {
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0)return false;
    }
    return true;
}

long long pow_mod(long long x, long long n) {
    x %= MOD;
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = (ret * x) % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return ret;
}//繰り返し二乗法
long long nCr_mod(long long n, long long r) {
    long long x = 1, y = 1;
    for (int i = 0; i < r; i++) {
        x = x * (n - i) % MOD;
        y = y * (i + 1) % MOD;
    }
    return x * pow_mod(y, MOD - 2) % MOD;
}//nCrをMODで割った余りO(N)?
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}//割り算のMOD(逆元)
//aをbで割ったやつをmで割った余りは、
//(a%m)*modinv(b,m)%m;
//#include <atcoder/all>
//using namespace atcoder;
//priority_queue<int, vector<int>, greater<int>> pq;


int N;
double dp[310][310][301];
bool seen[310][310][301];
double f(int a, int b, int c) {
    if (a + b + c == 0)return 0;
    if (seen[a][b][c])return dp[a][b][c];
    seen[a][b][c] = true;
    double ret = 0; 
    ret += N;
    if (a > 0)ret += ((double)f(a - 1, b, c) * a);
    if (b > 0)ret += (double)(f(a + 1, b - 1, c) * b);
    if (c > 0)ret += (double)(f(a, b + 1, c - 1) * c);
    ret /= (double)(N - (double)(N - a - b - c));
   
    cout << ret << endl;
    return dp[a][b][c] = ret;
}

int main() {
    cout << fixed << setprecision(15);

    int N; cin >> N;
    vector<double>A(N - 1);
    rep(i, N - 1)cin >> A[i];
    double v = 1;
    rep(i, N-1) {
        v *= (1000 - A[i]) / 1000;
    }
    cout << 1000 - 1000 * v << endl;
}
0