提出 #18331873


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fcout cout << fixed << setprecision(18)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll A, B, C; cin >> A >> B >> C;
  vector<vector<vector<double>>> dp(105, vector<vector<double>>(105, vector<double>(105, 0)));
  dp[99][99][99] = 0;
  for (ll i = 99; i >= 0; i--) {
    for (ll j = 99; j >= 0; j--) {
      for (ll k = 99; k >= 0; k--) {
        if (i + j + k == 0) continue;
        dp[i][j][k] =
          + (dp[i + 1][j][k] + 1) / (i + j + k) * i
          + (dp[i][j + 1][k] + 1) / (i + j + k) * j
          + (dp[i][j][k + 1] + 1) / (i + j + k) * k;
      }
    }
  }

  double ans = dp[A][B][C];
  fcout << ans << '\n';
  return 0;
}

提出情報

提出日時
問題 D - increment of coins
ユーザ nakaken88
言語 C++ (GCC 9.2.1)
得点 400
コード長 760 Byte
結果 AC
実行時間 32 ms
メモリ 13044 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 4
AC × 24
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
ケース名 結果 実行時間 メモリ
hand_01.txt AC 30 ms 12936 KiB
hand_02.txt AC 27 ms 12972 KiB
hand_03.txt AC 23 ms 13024 KiB
hand_04.txt AC 22 ms 13044 KiB
hand_05.txt AC 32 ms 13024 KiB
random_01.txt AC 24 ms 12980 KiB
random_02.txt AC 25 ms 12988 KiB
random_03.txt AC 29 ms 12976 KiB
random_04.txt AC 23 ms 12980 KiB
random_05.txt AC 23 ms 12980 KiB
random_06.txt AC 28 ms 12936 KiB
random_07.txt AC 23 ms 12920 KiB
random_08.txt AC 23 ms 12992 KiB
random_09.txt AC 31 ms 12932 KiB
random_10.txt AC 23 ms 12924 KiB
random_11.txt AC 30 ms 12936 KiB
random_12.txt AC 30 ms 12932 KiB
random_13.txt AC 22 ms 13020 KiB
random_14.txt AC 23 ms 12596 KiB
random_15.txt AC 32 ms 12980 KiB
sample_01.txt AC 22 ms 12988 KiB
sample_02.txt AC 25 ms 12980 KiB
sample_03.txt AC 30 ms 12940 KiB
sample_04.txt AC 27 ms 12976 KiB