#include <iostream>
#include <cstdlib>
using namespace std;

int main ()
{
  int nTrys=100000,nSer=50,nMon=10,stavka=1;
  int i,j,l, sCount=0,rNum;
  srand(time(NULL));
  
  for (i=0;i<nTrys;i++){
   l = nMon;j = 0;
   while (j<nSer && l>0){
    rNum = rand()%37;
    if (rNum == 0) l-=stavka;
    else if (rNum <= 18) l+=stavka;
         else l-=stavka;
    j++;
   }
   if (l == 0) sCount++;
  }
  cout << "Разорился " << sCount << " из " << nTrys;
  return 0;
}
