编程题库采购
发布时间: 2024-05-25 06:25:54
A. PASCAL璇瑷缂栫▼锛氢竴涓镣娄簨锻树笂琛楅噰璐锛岀敤500鍏冧拱浜90鍙楦★纴鍏朵腑姣嶉浮涓鍙15鍏冿纴鍏
Rem PASCAL璇瑷缂栫▼锛氢竴涓镣娄簨锻树笂琛楅噰璐锛岀敤500鍏冧拱浜90鍙楦★纴鍏朵腑姣嶉浮涓鍙15鍏冿纴鍏
Rem x=15 y=20
Rem 锲犱负鎴戜笉浼歅ASCAL鏁呯敤vb缂栫殑,鎴戝彧鏄璇存槑杩欑嶆柟娉
Private Sub Command1_Click()
x = 15 '杩欎釜鏄姣嶉浮镄勫崟浠
y = 5 '杩欎釜鏄鍏楦$殑鍗曚环 鎴戣$畻杩囦简杩椤彧链変簲镓岖﹀悎
For i = 1 To 90 '90涓哄崟绉嶉浮镄勬渶澶у
For j = 1 To 90 '90涓哄崟绉嶉浮镄勬渶澶у
If i * x + j * y = 500 And i + j = 90 Then
Rem 濡傛灉i涔榵锷爅涔榶绛変簬500鍜宨锷爅绛90
ss = ss & "缁撴灉:" & vbCrLf '锷犲叆缁撴灉
ss = ss & " 鍏楦" & i & "鍙" & " -> 鍏辩敤" & i * x & "镞" & vbCrLf & " 姣嶉浮" & j & "鍙" & " -> 鍏辩敤" & j * y & "镞" & vbCrLf
Exit For
End If
Next
Next
If ss <> "" Then MsgBox ss
End Sub
热点内容