第一范文网 - 专业文章范例文档资料分享平台

算分设计与实现 - 递归分治实验 

来源:用户分享 时间:2025/8/22 9:09:20 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 11 14 2 15 7 20 12 37 0 33 6 18 29 1 3 12 36 38 28 36 27 21 1 40 17 14 14 38 19 12 21 25 11 33 25 26 16 27 32 42 24 17 41 2 ※※※Sorted Array: 0 1 1 2 2 3 6 7 11 11 12 12 12 14 14 14 15 16 17 17 18 19 20 21 21 24 25 25 26 2 7 27 28 29 32 33 33 36 36 37 38 38 40 41 42 --------Test Sample #16: ※※※Origin Array: 0 27 37 38 2 25 33 13 15 5 3 29 14 20 23 31 25 5 20 24 11 24 23 15 10 3 2 20 35 4 27 7 38 3 14 20 20 3 13 ※※※Sorted Array: 0 2 2 3 3 3 3 4 5 5 7 10 11 13 13 14 14 15 15 20 20 20 20 20 23 23 24 24 25 25 2 7 27 29 31 33 35 37 38 38 --------Test Sample #17: ※※※Origin Array: 35 32 38 33 11 24 33 24 1 15 4 40 4 24 32 19 8 39 7 11 17 5 41 12 18 1 11 42 20 9 8 18 5 32 36 12 26 10 23 27 12 3 26 24 ※※※Sorted Array: 1 1 3 4 4 5 5 7 8 8 9 10 11 11 11 12 12 12 15 17 18 18 19 20 23 24 24 24 24 26 2 6 27 32 32 32 33 33 35 36 38 39 40 41 42 --------Test Sample #18: ※※※Origin Array: 7 20 0 21 25 23 9 22 29 7 23 8 0 32 7 34 27 16 12 27 3 28 28 22 23 23 21 21 39 3 5 8 24 3 19 13 27 23 32 1 12 37 12 40 17 ※※※Sorted Array: 0 0 1 3 3 7 7 7 8 8 9 12 12 12 13 16 17 19 20 21 21 21 22 22 23 23 23 23 23 24 2 5 27 27 27 28 28 29 32 32 34 35 37 39 40 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? --------Test Sample #19: ※※※Origin Array: 2 5 32 3 40 30 30 42 20 38 37 5 17 12 18 0 8 5 2 37 23 25 34 40 24 3 9 18 1 32 8 21 37 30 21 29 13 39 10 19 34 30 37 ※※※Sorted Array: 0 1 2 2 3 3 5 5 5 8 8 9 10 12 13 17 18 18 19 20 21 21 23 24 25 29 30 30 30 30 32 32 34 34 37 37 37 37 38 39 40 40 42 --------Test Sample #20: ※※※Origin Array: 7 20 18 3 2 15 19 4 21 10 0 16 13 2 5 15 7 4 15 14 8 19 23 16 ※※※Sorted Array: 0 2 2 3 4 4 5 7 7 8 10 13 14 15 15 15 16 16 18 19 19 20 21 23 --------Test Sample #21: ※※※Origin Array: 2 0 10 12 4 2 11 0 4 6 0 7 5 ※※※Sorted Array: 0 0 0 2 2 4 4 5 6 7 10 11 12 --------Test Sample #22: ※※※Origin Array: 16 13 11 8 4 17 0 16 9 14 7 16 6 8 16 14 12 10 2 15 ※※※Sorted Array: 0 2 4 6 7 8 8 9 10 11 12 13 14 14 15 16 16 16 16 17 --------Test Sample #23: ※※※Origin Array: 40 32 27 18 22 4 14 5 13 42 4 6 0 15 44 42 31 3 4 22 26 47 0 2 44 27 9 13 38 47 8 17 9 24 20 24 25 30 39 14 46 36 24 9 28 15 36 23 ※※※Sorted Array: 0 0 2 3 4 4 4 5 6 8 9 9 9 13 13 14 14 15 15 17 18 20 22 22 23 24 24 24 25 26 27 27 28 30 31 32 36 36 38 39 40 42 42 44 44 46 47 47 ? ? ? ? ? ? ? ? ? ? ? ? ? --------Test Sample #24: ※※※Origin Array: 0 ※※※Sorted Array: 0 --------Test Sample #25: ※※※Origin Array: 7 1 5 10 3 11 1 4 8 3 8 6 ※※※Sorted Array: 1 1 3 3 4 5 6 7 8 8 10 11 输出结果: ? 第二题 代码: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? #include #include using namespace std; #define inf 20 int iAnswer[inf];//满足条件的排列数 int iNum;//输入的方块数目 void Init()//初始化数组 { iNum=rand()%inf; } void calAnswer() { iAnswer[1]=3; iAnswer[2]=6; iAnswer[3]=6; for(int i=4;i<=inf;i++) iAnswer[i]=iAnswer[i-1]+2*iAnswer[i-2]; } int main() { int i; int iTestNum=25;//测试样例数目 srand((unsigned)time(NULL)); calAnswer(); for(i=1;i<=iTestNum;i++) { cout<<\ Init(); cout<<\※※※\ cout<<\※※※And the answer is \ cout<

搜索更多关于: 算分设计与实现 - 递归分治实验  的文档
算分设计与实现 - 递归分治实验 .doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c4sz0y6bm9h9jajr88ky455t2h95xc900w9d_2.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top