问题 填空题

试题六
阅读以下说明和流程图,填补流程图中的空缺。
[说明]
下面流程图的功能是:在已知字符串A中查找特定字符串B,如果存在,则输出B串首字符在A串中的位置,否则输出-1。设串A由n个字符A(0)、A(1)、…、A(n-1)组成,串B由m个字符B(0)、B(1)、…、B(m-1)组成,其中n≥m>0。在串A中查找串B的基本算法如下:从串A的首字符A(0)开始,取子串A(0)A(1)…i(m-1)与串B比较;若不同,则再取子串A(1)A(2)…A(m)与串B比较,以此类推。
例如,字符串“CABBRFFD”中存在字符子串“BRF”(输出3),不存在字符子串“RFD”(输出-1)。
在流程图中,i用于访问串A中的字符(i=0,1,…,n-1),j用于访问串B中的字符(j=0,1,…,m-1)。在比较A(i)A(i+1)…A(i+m-1)与B(0)B(1)…B(m-1)时,需要对A(i)与B(0)、A(i+1)与B(1)、…、A(i+j)与B(j)、…逐对字符进行比较。若发现不同,则需要取下一个子串进行比较,以此类推。
[流程图]
本题流程图如图8-30所示。

答案

参考答案:i+1

问答题 简答题
阅读理解

阅读理解。

     While small may be beautiful, tall is just plain uncomfortable it seems, particularly when it comes to staying

in hotels and eating in restaurants.

     The Tall Persons Club Great Britain (TPCGB), which was formed six months ago to campaign (发起运动)

for the needs of the tall, has turned its attention to hotels and restaurants. Beds that are too small, shower heads

that are too low, and restaurant tables with hardly any leg-room all make life difficult for those of above average

height, it says.

     But it is not just the extra-tall whose needs are not being met. The average height of the population has been

increasing yet the standard size of beds, doorways, and chairs has remained unchanged.

     "The bedding industry says a bed should be six inches larger than the person using it, so even a king-size

bed at 6'6"(6 feet and 6 inches) is falling short for 25% of men, while the standard 6'3"bed caters for (满足需

要) less than half of the male(男性) population,"said TPCGB president Phil Heinricy,"Seven-foot beds would

work fine."

     Similarly, restaurant tables can cause no end of problems. Small tables, which mean the long-legged have

to sit a foot or so away from them, are enough to make tall customers go elsewhere.

     Some have already taken note, however. At Queens Moat Houses' Caledonian Hotel in Edinburgh, 6'6" beds

are now put in as standard after requests for longer beds from taller visitors, particularly Americans.

1. What is the purpose of the TPCGB campaign? 

A. To provide better services.

B. To rebuild hotels and restaurants.

C. To draw public attention to the needs of the tall.

D. To attract more people to become its members.

2. Which of the following might be a bed of proper length according to Phil Heinricy?

A. 7'2"

B. 7'

C. 6'6"

D. 6'3"

3. What may happen to restaurants with small tables?

A They may lose some customers.

B. They may start businesses elsewhere.

C. They have to find easy chairs to match the tables.

D. They have to provide enough space for the long-legged.

4. What change has already been made in a hotel in Edinburgh?

A. Tall people pay more for larger beds.

B. 6'6" beds have taken the place of 6'3" beds.

C. Special rooms are kept for Americans.

D. Guest rooms are standardized.