Submission #19558160


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
using ll = long long; // int64_t
using ull = unsigned long long;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)

const int INF = 1230230230;   //10oku10

vector<vector<vector<double>>> dp(101, vector<vector<double>>(101, vector<double>(101,0)));

double e3 (int A , int B, int C) {
  if (dp[A][B][C] !=  0) return dp[A][B][C];
  if (A ==100 || B == 100 || C == 100 ) return 0;
  double ans = 0;
  ans += 1;
  if ( A != 0 ) ans += e3(A+1,B,C)*A / ((double)A+B+C);
  if ( B != 0 ) ans += e3(A,B+1,C)*B / ((double)A+B+C);
  if ( C != 0 ) ans += e3(A,B,C+1)*C / ((double)A+B+C);
  dp[A][B][C] = ans;
  return ans;
}

int main() {
  int A,B,C;
  cin >> A >> B >> C;

  cout <<  fixed << setprecision(10) << e3 (A,B,C) << endl;

}

Submission Info

Submission Time
Task D - increment of coins
User MiyakoTakanashi
Language C++ (GCC 9.2.1)
Score 400
Code Size 901 Byte
Status AC
Exec Time 39 ms
Memory 12000 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 4
AC × 24
Set Name Test Cases
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
Case Name Status Exec Time Memory
hand_01.txt AC 14 ms 11908 KB
hand_02.txt AC 10 ms 11952 KB
hand_03.txt AC 39 ms 11924 KB
hand_04.txt AC 9 ms 11920 KB
hand_05.txt AC 11 ms 11956 KB
random_01.txt AC 20 ms 12000 KB
random_02.txt AC 11 ms 11948 KB
random_03.txt AC 11 ms 11860 KB
random_04.txt AC 19 ms 11960 KB
random_05.txt AC 13 ms 11924 KB
random_06.txt AC 17 ms 11924 KB
random_07.txt AC 21 ms 11952 KB
random_08.txt AC 26 ms 11868 KB
random_09.txt AC 15 ms 11912 KB
random_10.txt AC 12 ms 11924 KB
random_11.txt AC 14 ms 11868 KB
random_12.txt AC 14 ms 11904 KB
random_13.txt AC 15 ms 11912 KB
random_14.txt AC 13 ms 11912 KB
random_15.txt AC 14 ms 11948 KB
sample_01.txt AC 12 ms 11900 KB
sample_02.txt AC 11 ms 11916 KB
sample_03.txt AC 9 ms 11996 KB
sample_04.txt AC 21 ms 11904 KB