问题 填空题

一列火车从A站到B站沿途共有n个车站(含A、B两站),火车上有一节邮政车厢,寄存往来的包裹.火车在任意车站停靠时,都要把已经经过的每一个车站托运到该车站的一个邮包放下,同时,又要把该站送往以后的每一个车站的每一个邮包托运上火车.假定火车在x站停靠,此时车上邮包总数y个,探究y与x函数关系式为______(结果可含n)

答案

当列车停靠在第x个车站时,

邮政车厢上需要卸下已经通过的(x-1)个车站发给该站的邮包共(x-1)个,

还要装上下面行程中要停靠的(n-x)个车站的邮包共(n-x)个.

根据题意,完成下表:

车站序号在第x车站启程时邮政车厢有保总数
1n-1
2(n-1)-1+(n-2)=2(n-2)
32(n-2)-2+(n-3)=3(n-3)
43(n-3)-3+(n-4)=4(n-4)
54(n-4)-4+(n-5)=5(n-5)
 
n0
由上表可得,y=x(n-x).

故答案为:y=x(n-x).

多项选择题
多项选择题

[说明]
以下Visual Basic代码实现了对位图(BMP)进行旋转显示。以下程序共实现了对BMP位图图形进行 180°旋转、90°旋转(顺时针)、90°旋转(逆时针)、水平翻转、垂直翻转共5项处理。显示界面如图12-8所示。仔细阅读[代码7-1]至[代码7-3],完成 (n) 代码,并写在对应栏内。


[代码7-1]
Begin VB. Form Form1
AutoRedraw =-1 ’True
Caption="图像的施转"
//...窗体描述( 略 )
Begin VB. CommandButton Command7
Caption="退出"
//...窗体描述(略 )
End
Begin VB.CommandButton Command6
Caption = "复位"
//...窗体描述(略)
End
Begin VB.CommandButton Command5
Caption= "垂直翻转"
//...窗体描述(略)
End
Begin VB.CommandButton Command4
Caption="水平翻转"
//...窗体描述(略)
End
Begin VB.CommandButton Command3
Caption= "90°(逆时针)"
//...窗本描述(略)
End
Begin VB.CommandButton Command2
Caption= "90°(顺时针)"
//...窗体描述(略)
End
Begin VB.PictureBox Picture2
//...窗体描述(略)
End
Begin VB.CommandButton Command1
Caption="180°"
//...窗体描述(略)
End
Begin VB.PictureBox Picture 1
//...窗体描述(略)
End
End
[代码7-2]
Private Declare Function BitBlt Lib "gdi32" ( ByVal hDestDC As Long,
ByVal x As Long,
ByVal y As Long,
ByVal n Width As Long,
ByVal nHeight As Long,
ByVal hSrcDC As Long,
ByVal xSrc As Long,
ByVal ySrc As Long,
ByVal dwRop As Long ) As Long
Const srcopy = &HCC0020
Dim h As Integer
Dim w As Integer
Private Sub Form_Load ( )
Picture2.Picture = LoadPicture ( App.Path & "\a01.bmp") ’导入图片’
h = Picture 1 .Height
w = Picture 1.Width
End Sub
[代码7-3]
Private Sub Commandl_Click ( ) 旋转180°
Picture2.Picture = LoadPicture ( "" )
For j = 0 To h Step 1
For i = 0 To w Step 1
(1)
Next i
Next j
End Sub
Private Sub Command2_Click ( ) ’顺时针施转90°’
Picture2.Picture = LoadPicture ( "" )
For i-h To 0 Step-1
For j - 0 To w Step 1
(2)
Next j
Next i
End Sub
Private Sub Command3_Click ( ) ’逆时针旋转90°’
Picture2.Picture = LoadPicture ("")
For j =w To 0 Step -1
For i = 0 To h Step 1
(3)
Next i
Next j
End Sub
Private Sub Command4 Click ( ) ’水平翻转
Picture2.Picture = LoadPicture ( "" )
For i = w To 0 Step -1
For j = 0 To h Step 1
(4)
Next j
Next i
End Sub
Private Sub Command5_Click ( ) ’垂直翻转
Picture2.Picmre = LoadPicmre ( "" )
Forj = 0 To h Step 1
For i = 0 To w Step I
(5)
Next i
Next j
End Sub
Private Sub Command6_Click ( ) ’复位
Picture2.Picture = LoadPicmre ( "" )
For i = 0 To w Step 1
For j = 0 To h Step 1
(6)
Next j
Next i
End Sub