的问题上,下数
2015-09-13 11:16
176 查看
在给定行的基础10的数量。在其下的放电填写相应的数十。
需要的下一行的每个数字是数十次出现在低行的行上。
需要的下一行的每个数字是数十次出现在低行的行上。
#include <iostream> using namespace std; const int n = 10; class BottomArr { public: BottomArr() { pre = new int ; bottom = new int {0}; for (int i = 0; i < n; i++) { pre[i] = i; } } ~BottomArr() { delete[]pre; delete[] bottom; } void getArr() { bool flag = true; while (flag) { flag = false; for (int i = 0; i < n; i++) { int count = getcount(i); if (count != bottom[i]) { bottom[i] = count; flag = true; } } } for (int i = 0; i < n; i++) { cout << bottom[i]<<" , "; } } int getcount(int i) { int count = 0; for (int j = 0; j < n; j++) { if (bottom[j] == i) { count++; } } return count; } int *bottom; int *pre; }; void main() { BottomArr arr; arr.getArr(); cout << "结束" << endl; cin.get(); }
相关文章推荐
- 【转载】2015年8月编程语言排行榜:Java遥遥领先
- php的时间输出格式
- ENOB测试程序
- Android Fragment
- Android4.4的zygote进程(上)
- 关于MPAndroidChart柱状图左右滑动
- 【Direct3D】Mesh part
- 软件测试管理知识点总结 (三)
- 其它
- 最值得关注的10个C开源项目
- Python+OpenCV学习(9)---SIFT
- MCU PWM DAC OP Voltage Output
- Javascript原型
- 【JavaScript】学习笔记(函数,符号,循环)
- 【转载】我多希望我学编程时,有人教我这些事!
- Lan Xiang's Square 1099 (简单几何 较坑 )
- C++-----利用括号递归实现的加减乘除
- Activity
- 任意长度的高精度大整数加法
- 数据结构之数组实现哈希表应用总结篇