- 帖子
- 3
- 积分
- 14
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2021-1-28
|
64楼
发表于 2023-6-1 17:40
| 只看该作者
作业:百钱百鸡 编码:ANSI
Dim a, i, j, k, l, n, m
a = 0
For i = 0 To 20
For j = 0 To 100 / 3
For k = 0 To 100
If i * 5 + j * 3 + k / 3 = 100 And i + j + k = 100 And k Mod 3 = 0 Then
l = "公鸡有:" & i
n = "母鸡有:" & j
m = "小鸡有:" & k
why = MsgBox(l & vbCrLf & n & vbCrLf & m, 0, "百钱百鸡")
a = a + 1
End If
Next
Next
Next
MsgBox ("共有解法:" & a) |
|