Distribute R , B beans such that each packet has at least 1 R and 1 B bean with absolute difference at most D | C # program for the above approach ; Function to check if it is possible to distribute R red and B blue beans in packets such that the difference between the beans in each packet is atmost D ; Check for the condition to distributing beans ; Print the answer ; Distribution is not possible ; Driver code
using System ; class GFG { static void checkDistribution ( int R , int B , int D ) { if ( Math . Max ( R , B ) <= Math . Min ( R , B ) * ( D + 1 ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } static public void Main ( ) { int R = 1 , B = 1 , D = 0 ; checkDistribution ( R , B , D ) ; } }