注册 登录
编程论坛 汇编论坛

求组~VBA编程问题~我是菜鸟

saulkings123 发布于 2007-07-04 11:25, 802 次点击

取一元、二元、五元的硬币共23枚(每种硬币至少取1枚),付给45元钱,有______种不同的取法。(仅回答有多少种)

2 回复
#2
saulkings1232007-07-04 11:50
Private Sub Command0_Click()
Dim n As Integer, m As Integer, p As Integer, q As Integer, s As Integer, a As Integer
s = 23
a = 45
q = 0
If s = n + m + p And a = n + 2 * m + 5 * p Then
q = q + 1
End If
MsgBox q
End Sub
为什么不可以哦?
#3
wayzbaby2007-07-11 18:52
dim a,b,c as integer,s,n as integer
if a>=1 and b>=1 and c>=1 then
if a+b+c=23 and 2*a+1*b+5*c=45 then
n=n+1
end if
end if
msgbox "a" & a & "b" & b & "c" & c & "total" & n
1