皮皮学,免费搜题
登录
logo - 刷刷题
搜题
【简答题】
阅读以下说明和C程序,将应填入(n)处的字句写在对应栏内。 【说明】 下面的程序用DoleRob算法生成N阶(N为奇数)魔方阵(各行、列、对角线数字之和相等)。该算法的过程为:从1开始,按如下方法依次插入各自然数,直到N2为止。 a.在第一行的正中插入1。 b.新位置应当处于最近插入位置的右上方,若该位置已超出方阵的上边界,则新位置取的最下一个位置;若超出右边界,则新位置取的最左一个位置。 c.若最近插入的元素是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'); } }
手机使用
分享
复制链接
新浪微博
分享QQ
微信扫一扫
微信内点击右上角“…”即可分享
反馈
参考答案:
举一反三
【判断题】与人有关的普利昂病有家族克雅氏症。
A.
正确
B.
错误
【简答题】Combine the sentence beginnings in Column A with the endings in Column B to form complete sentences.
【简答题】Combine the sentence beginning in Column A with the endings in Column B to form complete sentences.
【多选题】划像类视频过渡特效有哪些?
A.
交叉划像
B.
圆划像
C.
盒形划像
D.
菱形划像
【简答题】连线题-4. Combine the sentence beginnings in Column A with the endings in Column B to form complete sentences.
【简答题】古典舞的手型有哪些?
【判断题】Most capital investment by U.S companies is funded by retained earnings and reinvested depreciation.
A.
正确
B.
错误
【简答题】Combine the following pairs of sentence according to the model.
【多选题】在舞蹈设计中吸收了多种元素以达到芭蕾的民族化,塑造出哪些形象鲜明的人物性格?
A.
用“足尖弓箭步亮相”及独舞 和双人舞中的 “倒踢紫金冠” 、 “乌龙绞柱”等强烈有力的倔强舞姿来表现 琼花性格顽强泼辣
B.
吸收了 京剧“亮相”的手法 来表现 洪常青 的刚强性格
C.
用 中国古典舞 身段 和 表演 的造型出场 ,表现 南霸天和老四等反面人物
【简答题】Combine the sentence in column A with the phrase in column B so that they make sense. prefix="o" ns="urn:schemas-microsoft-com:office:office" ?xml:namespace>
相关题目:
参考解析:
知识点:
题目纠错 0
发布
创建自己的小题库 - 刷刷题