Minimum number of pigs required to find the poisonous bucket | C ++ program for the above approach ; Function to find the minimum number of pigs required to find the poisonous bucket ; Print the result ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void poorPigs ( int buckets , int minutesToDie , int minutesToTest ) { cout << ceil ( log ( buckets ) / log ( ( minutesToTest / minutesToDie ) + 1 ) ) ; } int main ( ) { int N = 1000 , M = 15 , P = 60 ; poorPigs ( N , M , P ) ; return 0 ; }