题目
vb 中1元的钞票换成一分 二分 五分 每个至少8个 几种方案
提问时间:2021-03-25
答案
Private Sub Command1_Click()
Dim Yuan As Long
Dim Fen1 As Long
Dim Fen2 As Long
Dim Fen5 As Long
Dim ZongFen As Long
Dim FangAn As Long
Dim Min As Long
Dim i As Long, j As Long, k As Long
Yuan = 1 * 100 '一元等于100分
Fen1 = 1
Fen2 = 2
Fen5 = 5
Min = 8 '每个面值最少8张
ZongFen = Yuan - Fen1 * Min - Fen2 * Min - Fen5 * Min '减除每个面值最少8张总分数
For i = 0 To Fix(ZongFen / Fen5) '循环组合
For j = 0 To Fix((ZongFen - Fen5 * i) / Fen2)
If ZongFen - Fen2 * j - Fen5 * i >= 0 Then
ZongFen = ZongFen - Fen2 * j - Fen5 * i
FangAn = FangAn + 1
List1.AddItem ZongFen + Min & "张一分 + " & j + Min & "张二分 + " & i + Min & "张五分 = " & ZongFen + Min + (j + Min) * Fen2 + (i + Min) * Fen5 & "分"
ZongFen = Yuan - Fen1 * Min - Fen2 * Min - Fen5 * Min
End If
Next
Next
MsgBox FangAn & "个方案!"
End Sub
Dim Yuan As Long
Dim Fen1 As Long
Dim Fen2 As Long
Dim Fen5 As Long
Dim ZongFen As Long
Dim FangAn As Long
Dim Min As Long
Dim i As Long, j As Long, k As Long
Yuan = 1 * 100 '一元等于100分
Fen1 = 1
Fen2 = 2
Fen5 = 5
Min = 8 '每个面值最少8张
ZongFen = Yuan - Fen1 * Min - Fen2 * Min - Fen5 * Min '减除每个面值最少8张总分数
For i = 0 To Fix(ZongFen / Fen5) '循环组合
For j = 0 To Fix((ZongFen - Fen5 * i) / Fen2)
If ZongFen - Fen2 * j - Fen5 * i >= 0 Then
ZongFen = ZongFen - Fen2 * j - Fen5 * i
FangAn = FangAn + 1
List1.AddItem ZongFen + Min & "张一分 + " & j + Min & "张二分 + " & i + Min & "张五分 = " & ZongFen + Min + (j + Min) * Fen2 + (i + Min) * Fen5 & "分"
ZongFen = Yuan - Fen1 * Min - Fen2 * Min - Fen5 * Min
End If
Next
Next
MsgBox FangAn & "个方案!"
End Sub
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
热门考点
- 1写出三个小于10的自然数,使他们三个数中有两个数的最大公约数为1,其余的最大公约数大于1.
- 2狗说的故事给我的启示 (马克吐温)
- 3英语翻译
- 4反义疑问句中 You must be from America后应该加什么
- 5一个半圆的周长是15.42厘米,那么它的半径是多少厘米? 先计算,再画出这个半圆. 计算: 画图:
- 6Please r_____ to clean the blackboard.
- 7AI2O3中混有Fe2O3怎么除杂,AI2O3中混有SiO2怎么除杂
- 8莲蓬壳有什么作用?
- 9what's for lunch?what have you got for lunch?的中文意识分别是什么?有什么区别
- 10数学中公理,定理,推理的联系与区别