用vb程序表示不定方程3x-7y=1,在|x|<=1oo,|y|<=50内整数解的组数,以及|x
答案:1 悬赏:0 手机版
解决时间 2021-03-10 18:29
- 提问者网友:焚苦与心
- 2021-03-10 06:24
用vb程序表示不定方程3x-7y=1,在|x|<=1oo,|y|<=50内整数解的组数,以及|x
最佳答案
- 五星知识达人网友:愁杀梦里人
- 2021-03-10 07:55
Private Type myxy
m As Integer
n As Integer
End Type
Private Sub Form_Click()
Dim myxy() As myxy
Dim x%, y%, s%()
i = 1
ReDim myxy(1)
For x = -100 To 100
For y = -50 To 50
If 3 * x - 7 * y = 1 Then
With myxy(i)
.m = x
.n = y
End With
i = i + 1
ReDim Preserve myxy(i)
End If
Next
Next
Print "求得不定方程的解为:"
For j = 1 To i - 1
Print myxy(j).m; myxy(j).n
Next
k = i - 1
myMax = 0
ReDim s(k)
For i = 1 To k
s(i) = Abs(myxy(i).m) + Abs(myxy(i).n)
Next
For i = 1 To k
If myMax < s(i) Then myMax = s(i)
Next
Print "|x|+|y|的最大值为:"; myMax
End Sub
m As Integer
n As Integer
End Type
Private Sub Form_Click()
Dim myxy() As myxy
Dim x%, y%, s%()
i = 1
ReDim myxy(1)
For x = -100 To 100
For y = -50 To 50
If 3 * x - 7 * y = 1 Then
With myxy(i)
.m = x
.n = y
End With
i = i + 1
ReDim Preserve myxy(i)
End If
Next
Next
Print "求得不定方程的解为:"
For j = 1 To i - 1
Print myxy(j).m; myxy(j).n
Next
k = i - 1
myMax = 0
ReDim s(k)
For i = 1 To k
s(i) = Abs(myxy(i).m) + Abs(myxy(i).n)
Next
For i = 1 To k
If myMax < s(i) Then myMax = s(i)
Next
Print "|x|+|y|的最大值为:"; myMax
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯