[说明] 下面的程序用Dole Rob算法生成N阶(N为奇数)魔方阵(各行、列、对

题型:填空题

问题:

[说明]
下面的程序用Dole Rob算法生成N阶(N为奇数)魔方阵(各行、列、对角线数字之和相等)。该算法的过程为:从1开始,按如下方法依次插入各自然数,直到N2为止。
①在第一行的正中插入1。
②新位置应当处于最近插入位置的右上方,若该位置已超出方阵的上边界,则新位置取应选列的最下一个位置;若超出右边界,则新位置取应选行的最左一个位置。
③若最近插入的元素是N的整数倍,则选同列的下一行位置为新位置。
例如,3阶魔方阵如下所示:
8 1 6
3 5 7
4 9 2
[C程序]
#include<stdio.h>
#include<stdlib.h>
#define SIZE 50
main( )

int row, col, n, value;
int a[SIZE+1][SIZE+1]; /*不使用下标为0的元素*/
printf("请输入要输出魔方阵的阶数n(奇数, <%d):n=", SIZE);
scanf("%d", &n);
if(!(n%2) || n<1 || (1) )
printf("输入数据有误!\n");
exit(0);

row=1; col=(n+1)/2; value=1;
while(value<= (2) )
a[row][col]=value;
/*计算下一位置*/
if(value%n!=0)
row--; (3) ;
if(row<1)row=n;
if(col>n) (4) ;

else row++;
value= (5) ;

printf("\n%d阶魔方阵如下所示:\n\n", n);
for(row=1; row<=n; row++)
for(col=1; col<=n; col++)
printf("%5d", a[row][col]);
printf("\n");


考点:计算机软件水平考试初级程序员程序员
题型:填空题

阅读短文,选择正确答案。

      You can see lots of kangaroos (袋鼠) in Australia, and not only in zoos but also outside the cities and towns.

You can see them everywhere. Kangaroos are very popular in Australia. They have very strong legs, so they are

very good at jumping. Their tails (尾巴) are very strong, too, so when they want to have a rest, they rest on

their tails. Kangaroos are also good at looking after their babies. Mother kangaroos keep their babies safe in their

pockets.

1. There are many kangaroos _____. [ ]

A. from Australia

B. in America

C. in Australia

D. from America

2. Where can we see kangaroos in Australia? [ ]

A. in cities.

B. in towns.

C. in parks.

D. everywhere.

3. Why are kangaroos very good at jumping? [ ]

A. because they are very healthy.

B. because they have strong tails.

C. because they have strong legs.

D. because they have big pockets.

4. How do kangaroos rest when they want to rest? [ ]

A. on their legs.

B. on their hands.

C. on their tails.

D. on their back.

5. What are kangaroos good at doing? [ ]

A. they are good at looking after their babies.

B. they are good at jumping.

C. they are good at resting on their tails.

D. A, B and C.

题型:填空题

Professor White has written some short stories, but he is___known for his plays.

A.the best

B.more

C.better

D.the most

题型:填空题

急性根尖周炎浆液期的临床症状之一,除外

A.自发痛

B.叩诊痛

C.牙髓无活力

D.患牙浮出感

E.咬紧牙时痛加重

题型:填空题

对先张法和后张法的预应力混凝土构件,如果采用相同的张拉控制应力,则()。

A.后张法所建立的钢筋有效预应力比先张法小

B.后张法所建立的钢筋有效预应力与先张法相同

C.先张法所建立的钢筋有效预应力比后张法小

题型:填空题

患者胸廓对称,一侧语颤增强,叩诊呈实音

A.气胸
B.胸腔积液
C.肺气肿
D.肺实变
E.胸膜增厚与粘连

更多题库