![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
宇宙蛋
数学爱好者 研究领域为ml+rs 偶尔捣鼓下代码
展开
-
异或双向链表
//由于利用cpp的引用 文件名保存为*.cpp #include #include #include #include #include #include //宏定义 #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 #define O原创 2013-03-18 19:27:34 · 1300 阅读 · 0 评论 -
二分查找 递归与非递归 编程之美写法
#include using namespace std; /** 二分查找 * * key 待查找元素 * begin 数组起始位置 * end 数组结束位置 * 返回值为待查找的元素在数组位置 若找不到 则返回-1 * */ int BinarySearch(int array[], int begin, int end,int key) { while(原创 2014-10-15 16:58:50 · 800 阅读 · 0 评论 -
士兵排队---统计每个士兵看到后排士兵的总数
问题描述 训练场上n(1≤n≤50000)个高矮都不相同的士兵从左到右排成一行,依次编号为1,2,…,n。第i个士兵的身高H(i),由于采用特殊单位,H(i)满足1≤H(i)≤2000000000。设第i个士兵右侧最近的比他个高的士兵编号为j,则第i个士兵可看到在他的右侧比他矮的士兵的个数S(i)=j-i-1。(不考虑客观因素,比如视力范围等-,-) 求S(1)+S(2)+…+S(n)。 输原创 2013-03-18 19:44:00 · 740 阅读 · 0 评论