Minimum number of pigs required to find the poisonous bucket | Java program for the above approach ; Function to find the minimum number of pigs required to find the poisonous bucket ; Print the result ; Driver Code
import java . io . * ; class GFG { static void poorPigs ( int buckets , int minutesToDie , int minutesToTest ) { System . out . print ( ( int ) Math . ceil ( Math . log ( buckets ) / Math . log ( ( minutesToTest / minutesToDie ) + 1 ) ) ) ; } public static void main ( String [ ] args ) { int N = 1000 , M = 15 , P = 60 ; poorPigs ( N , M , P ) ; } }