Submission #19558317


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

map<int,double> mp;

double e3 (int A , int B, int C) {
  int X = A*1000000+B*1000+C;
  if (mp.find(X) != mp.end()) return mp[X];
  if (A ==100 || B == 100 || C == 100 ) {
    mp[X] = 0;
    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);
  mp[X] = 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 881 Byte
Status AC
Exec Time 786 ms
Memory 66224 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 11 ms 3796 KB
hand_02.txt AC 4 ms 3840 KB
hand_03.txt AC 786 ms 66224 KB
hand_04.txt AC 2 ms 3792 KB
hand_05.txt AC 12 ms 4948 KB
random_01.txt AC 91 ms 13972 KB
random_02.txt AC 24 ms 5944 KB
random_03.txt AC 13 ms 5004 KB
random_04.txt AC 112 ms 16704 KB
random_05.txt AC 18 ms 5664 KB
random_06.txt AC 224 ms 23760 KB
random_07.txt AC 131 ms 17192 KB
random_08.txt AC 365 ms 33796 KB
random_09.txt AC 99 ms 12272 KB
random_10.txt AC 62 ms 9796 KB
random_11.txt AC 22 ms 5024 KB
random_12.txt AC 32 ms 7012 KB
random_13.txt AC 67 ms 10680 KB
random_14.txt AC 56 ms 8944 KB
random_15.txt AC 82 ms 11880 KB
sample_01.txt AC 1 ms 3664 KB
sample_02.txt AC 2 ms 3700 KB
sample_03.txt AC 2 ms 3760 KB
sample_04.txt AC 104 ms 14696 KB