我国古代数学家在《算经》中出了一道题:鸡翁一,值钱五;鸡母一,值钱三;鸡雏三,值钱一。百钱买百鸡,问鸡翁、母、雏各几何?”意为公鸡4吊钱1只,母鸡3吊钱1只,3只小鸡值1吊钱。编程实现用100吊钱买100只鸡,公鸡、母鸡、小鸡每种鸡至少一只,有多少种买法?(2)
Private Sub command1_Click()
Dim a%, b%, c%, s%
FontSize = 14: FontBold = True
Print: Print: Print
s = 0
For a = 1 To 20
For b = 1 To 34
If 4 * a + 3 * b + c / 3 = 100 Then s = s + 1
Next b
Next a
Print s
End Sub
要将一张100元的大钞票,换成等值的10元、5元、2元和1元一张的小钞票。要求每次换成50张小钞票,每种至少一张。编程求有多少种换法。(26)
Private Sub Command1_Click()
Dim i, j, k, m As Integer
Dim RMBsum As Integer
FontSize = 14: FontBold = True
For i = 1 To 9
For j = 1 To 17
For k = 1 To 37
m = 50 - i - j - k
If Then RMBsum = RMBsum + 1
Next k, j, i
Print RMBsum
End Sub