VB编程,求步骤有一根长度为546米的钢材料,要将它截取成两种规格a、b的长度分别为19米和28米的短料,每种至少1段,
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/11/06 04:48:38
VB编程,求步骤
有一根长度为546米的钢材料,要将它截取成两种规格a、b的长度分别为19米和28米的短料,每种至少1段,问分隔成a,b各多少段后,剩余的残料r最少?编程解决此计算问题.
有一根长度为546米的钢材料,要将它截取成两种规格a、b的长度分别为19米和28米的短料,每种至少1段,问分隔成a,b各多少段后,剩余的残料r最少?编程解决此计算问题.
'19米14,28米10,剩余0 加个text,设为多行显示Text1.MultiLine = True
Private Sub Command1_Click()
Dim tmp As Variant
Dim tmp1 As Single, tmp2 As Single, s_tp As String
Dim tmp3 As Variant
Dim s1 As String, ss As String, l_tp As Single
Dim i As Long, l As Long, x As Long, k1 As Long, k2 As Long, k3 As Long, k4 As Long, kk As Long
kk = 546
k1 = 19
k2 = 28
k3 = kk \ k1k4 = kk \ k2
For i = 1 To k3
For l = 1 To k4
l_tp = i * k1 + l * k2
If l_tp tmp2 Then
s_tp = tmp(i)
tmp(i) = tmp(x)
tmp(x) = s_tp
End If
Next
Next
Print tmp(UBound(tmp))
ss = k1 & "米," & k2 & "米," & "剩余"
For i = UBound(tmp) To 0 Step -1
ss = ss & vbCrLf & tmp(i)
' Print tmp(i)
Next
Text1.Text = ss
MsgBox "利用率最高的方法是" & tmp(UBound(tmp))
End Su
Private Sub Command1_Click()
Dim tmp As Variant
Dim tmp1 As Single, tmp2 As Single, s_tp As String
Dim tmp3 As Variant
Dim s1 As String, ss As String, l_tp As Single
Dim i As Long, l As Long, x As Long, k1 As Long, k2 As Long, k3 As Long, k4 As Long, kk As Long
kk = 546
k1 = 19
k2 = 28
k3 = kk \ k1k4 = kk \ k2
For i = 1 To k3
For l = 1 To k4
l_tp = i * k1 + l * k2
If l_tp tmp2 Then
s_tp = tmp(i)
tmp(i) = tmp(x)
tmp(x) = s_tp
End If
Next
Next
Print tmp(UBound(tmp))
ss = k1 & "米," & k2 & "米," & "剩余"
For i = UBound(tmp) To 0 Step -1
ss = ss & vbCrLf & tmp(i)
' Print tmp(i)
Next
Text1.Text = ss
MsgBox "利用率最高的方法是" & tmp(UBound(tmp))
End Su
VB编程,求步骤有一根长度为546米的钢材料,要将它截取成两种规格a、b的长度分别为19米和28米的短料,每种至少1段,
vb编程,步骤详解有一根长度为546米的钢材料,要将它截取成两种规格a、b的长度分别为19米和28米的短料,每种至少1段
题目:有一根长度为321米的钢材,要将它截取为两种规格的 '短料,两种规格的长度分别为a米、b米
问个编程的问题.有1根长度为30米的钢材料,要将他截取成两种规格a.b.a.b的长度分别为3.8米和4米的短料.
vb语言 帮做程序 有1根长度为321米的钢材料,要将他截取成两种规格a.b.
将一根26米长的钢料,截成规格分别2米.3米和8米的较短的料,每种规格的料至少有一根,怎么截才能使原来的钢
2.8米长的钢材,要截成1.2米和0.9米两种长度的钢材段,现在要截两种钢料各60段,至少需要2,8米的钢材()
有两根钢材,长度分别是12米和20米,现在要把它们锯成相同长度的小段,每段的每段的长度是整米数且不能浪费
一根绳子,已截取的长度比全长的4分之1多13米,未截取的长度比全长的3分之2少3米,求绳子原来长度
一根钢管,第一次截取a米,第二次截取余下的n/m,这时剩下的钢管长度与截取的同样长 原来多长
一根电线长180米,将它截成三段,第一段比第二段长20米,第三段长为第一段长的2倍,则第二段的长度为多少米?
有一条长度为359mm的钢管,要把它锯与长度分别为59mm和39mm两种不同规格的小钢管(要求没有余料),每锯一