If x were 94 and y and z were each zero, H would be 94 * 4 = 376, the minimum possible. Diverting 1 from x to y increases H by 6; diverting it to z would increase it by 15.
By converting some of the allocation of x to y and/or z we can add amounts:
6 15
12 30
18 45
24 60
30 75
Added amounts can be 6, 12, 15, 18, 21, ...
or any multiple of 3 up to near the upper limit of 19 * 94 = 1786. Amounts near that limit can be gotten by subtracting from 1786:
9 15
18 30
27 45
36 60
45 75
Subtractable amounts are 9, 15, 18, 24, 27, 30, ...
and any multiple of 3 down to near the lower limit.
Both the upper and lower amounts (1786 and 376) are 1 above a multiple of 3.
There are 471 such values (3k+1) between 376 and 1786 inclusive. Six of them are not achievable: 376+3, 376+9, 1786-3, 1786-6, 1786-12, 1786-21. That leaves 465 values of H that are achievable.
Verification:
DefDbl A-Z
Dim crlf$, used(1786)
Function mform$(x, t$)
a$ = Format$(x, t$)
If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
mform$ = a$
End Function
Private Sub Form_Load()
ChDir "C:\Program Files (x86)\DevStudio\VB\projects\flooble"
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
DoEvents
tot = 94
For n4 = 0 To tot
For n10 = 0 To tot - n4
n19 = tot - n4 - n10
ht = 4 * n4 + 10 * n10 + 19 * n19
used(ht) = used(ht) + 1
Next
Next
For i = 1 To 1786
If used(i) Then Text1.Text = Text1.Text & Str(i): totct = totct + 1
Next
Text1.Text = Text1.Text & crlf & totct & crlf & "done"
End Sub
shows
376 382 388 391 394 397 400 403 406 409 412 415 418 421 424 427 430 433 436 439 442 445 448 451 454 457 460 463 466 469 472 475 478 481 484 487 490 493 496 499 502 505 508 511 514 517 520 523 526 529 532 535 538 541 544 547 550 553 556 559 562 565 568 571 574 577 580 583 586 589 592 595 598 601 604 607 610 613 616 619 622 625 628 631 634 637 640 643 646 649 652 655 658 661 664 667 670 673 676 679 682 685 688 691 694 697 700 703 706 709 712 715 718 721 724 727 730 733 736 739 742 745 748 751 754 757 760 763 766 769 772 775 778 781 784 787 790 793 796 799 802 805 808 811 814 817 820 823 826 829 832 835 838 841 844 847 850 853 856 859 862 865 868 871 874 877 880 883 886 889 892 895 898 901 904 907 910 913 916 919 922 925 928 931 934 937 940 943 946 949 952 955 958 961 964 967 970 973 976 979 982 985 988 991 994 997 1000 1003 1006 1009 1012 1015 1018 1021 1024 1027 1030 1033 1036 1039 1042 1045 1048 1051 1054 1057 1060 1063 1066 1069 1072 1075 1078 1081 1084 1087 1090 1093 1096 1099 1102 1105 1108 1111 1114 1117 1120 1123 1126 1129 1132 1135 1138 1141 1144 1147 1150 1153 1156 1159 1162 1165 1168 1171 1174 1177 1180 1183 1186 1189 1192 1195 1198 1201 1204 1207 1210 1213 1216 1219 1222 1225 1228 1231 1234 1237 1240 1243 1246 1249 1252 1255 1258 1261 1264 1267 1270 1273 1276 1279 1282 1285 1288 1291 1294 1297 1300 1303 1306 1309 1312 1315 1318 1321 1324 1327 1330 1333 1336 1339 1342 1345 1348 1351 1354 1357 1360 1363 1366 1369 1372 1375 1378 1381 1384 1387 1390 1393 1396 1399 1402 1405 1408 1411 1414 1417 1420 1423 1426 1429 1432 1435 1438 1441 1444 1447 1450 1453 1456 1459 1462 1465 1468 1471 1474 1477 1480 1483 1486 1489 1492 1495 1498 1501 1504 1507 1510 1513 1516 1519 1522 1525 1528 1531 1534 1537 1540 1543 1546 1549 1552 1555 1558 1561 1564 1567 1570 1573 1576 1579 1582 1585 1588 1591 1594 1597 1600 1603 1606 1609 1612 1615 1618 1621 1624 1627 1630 1633 1636 1639 1642 1645 1648 1651 1654 1657 1660 1663 1666 1669 1672 1675 1678 1681 1684 1687 1690 1693 1696 1699 1702 1705 1708 1711 1714 1717 1720 1723 1726 1729 1732 1735 1738 1741 1744 1747 1750 1753 1756 1759 1762 1768 1771 1777 1786
for a count of
465
|
Posted by Charlie
on 2014-10-16 10:39:49 |