All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Counting Quadruplets II (Posted on 2010-09-21)
Each of A, B, C and D is a positive integer with the proviso that A ≤ B ≤ C ≤ D ≤ 20

Determine the total number of quadruplets (A, B, C, D) such that: A*B + C*D > 300.

What is the total number of quadruplets (A, B, C, D) such that: A*B - C*D > 100?

 No Solution Yet Submitted by K Sengupta No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 solution Comment 2 of 2 |

FOR a = 1 TO 20
FOR b = a TO 20
FOR c = b TO 20
FOR d = c TO 20
IF a * b + c * d > 300 THEN gt300 = gt300 + 1
IF a * b - c * d > 100 THEN gt100 = gt100 + 1
IF c * d - a * b > 100 THEN rgt100 = rgt100 + 1
ct = ct + 1
NEXT
NEXT
NEXT
NEXT

PRINT gt300, gt100, rgt100, ct

shows

3254          0             6347          8855

That is, of the 8855 quadruplets meeting the ordering criteria, 3254 have A*B + C*D > 300, but none have A*B - C*D > 100.  If the latter were reversed, however, there'd be 6347 with C*D - A*B > 100.

 Posted by Charlie on 2010-09-21 17:36:38

 Search: Search body:
Forums (0)