Search
 
SCRIPT & CODE EXAMPLE
 

CPP

expected number of trials to get n consecutive heads

#include "bits/stdc++.h"
using namespace std;
  
// Driver Code
int main()
{
    int N = 3;
  
    // Formula for number of trails for
    // N consecutive heads
    cout << pow(2, N + 1) - 2;
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ double to string 
Cpp :: for loop reverse C++ 
Cpp :: c++ remove last element from vector 
Cpp :: penjanje 
Cpp :: compile notepad++ c++ 
Cpp :: c++ cmd program run in background 
Cpp :: return the index where maximum element in a vector 
Cpp :: call of overloaded ‘swap(int&, int&)’ is ambiguous 
Cpp :: random in range c++ 
Cpp :: 2d vector initialization in cpp 
Cpp :: landscape overleaf 
Cpp :: qt qstring to double 
Cpp :: qt label set text color 
Cpp :: convert a int to string c++ 
Cpp :: cpp float to int 
Cpp :: remove element from vector on condition c++ 
Cpp :: float max value c++ 
Cpp :: extends c++ 
Cpp :: how to make a c++ program which takes two integers and calculate average 
Cpp :: cpp mst 
Cpp :: double to string c++ 
Cpp :: delete last char of string c++ 
Cpp :: c++ vector sort 
Cpp :: appending int to string in cpp 
Cpp :: cpp convert vector to set 
Cpp :: elements of set c++ 
Cpp :: binary file in c++ 
Cpp :: c++ create multidimensional vector 
Cpp :: overload stream insert cpp 
Cpp :: print 2d array c++ 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =