简单的题目,如题:找出字符串中的反转次数。按反转次数从小到大输出。
反转次数,就是字符串中的每一个跟它后面的每一个字符比较,比后面的大的,次数+1.
下面的是AC的代码:
#include
#include
#include
#include
using namespace std;
class data
{
public:
char str[55];
int count;
}...
分类:
其他好文 时间:
2015-06-14 12:35:48
阅读次数:
174
题目连接http://poj.org/problem?id=2299Ultra-QuickSortDescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm process...
分类:
其他好文 时间:
2015-06-12 20:42:41
阅读次数:
111
/** \brief poj 2388 insert sorting 2015 6 12
*
* \param
* \param
* \return
*
*/
#include
#include
#include
using namespace std;
const int N=10000;
int Arr[N];
void insertSort(int len)
{
...
分类:
其他好文 时间:
2015-06-12 19:32:56
阅读次数:
135
Database DesignRuleDescriptionValueSourceProblem Description1Excessive sorting and RID lookup operations should be reduced with covered indexes.Sys.d....
分类:
移动开发 时间:
2015-06-12 10:02:42
阅读次数:
222
题目大意:给出n张透明的矩形纸张散乱在桌上,每张纸张上面都有一个数字。
现在给出每个矩形的左下角和右上角坐标和每个数字所在的位置,问能否找出每个矩形的唯一对应数字解题思路:分析该题可得到,二分图匹配的结果肯定是完美匹配,匹配的结果肯定为n。
接着就要判断每个点是否唯一匹配了
判断能否唯一匹配,就要在完美匹配的情况下,删除该点的那条匹配,如果还能再找出一个完美匹配,那么该点就不是唯一表示的了#i...
分类:
其他好文 时间:
2015-06-09 17:24:50
阅读次数:
164
题目本身很简单,只需要设计结构体Person存储一条记录,然后使用容器容纳所有Person记录,使用sort函数按照不同的规则排序即可。
最初我最后一个测试点出现了超时,当时十分费解,还认为可能是STL的排序函数速度不够快,后来在网上查阅大家对这个题的体会发现是cin和cout不够快造成的,记得姥姥曾经说过少用cin和cout,但是没有重视T T,果然将cin和cout改成scanf和printf即可通过最后一个测试点。...
分类:
其他好文 时间:
2015-06-05 17:43:34
阅读次数:
162
作者:xiabodan 出处:http://blog.csdn.net/xiabodan
排序算法(Sorting
Algorithm)是计算机算法的一个组成部分。也是程序=算法+数据结构中的一部分(算法)。
实验平台:raspberry 2 B +
Ubuntu Mate
插入排序
//插入排序
//stable
//O(N^2) comparisons and swaps...
分类:
编程语言 时间:
2015-06-04 15:49:33
阅读次数:
151
Description
In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the seque...
分类:
其他好文 时间:
2015-06-03 15:48:26
阅读次数:
108
Well, this problem has a naive solution, which is to sort the array in descending order and return thek-1-th element. However, sorting algorithm gives...
分类:
其他好文 时间:
2015-06-03 00:38:52
阅读次数:
230
七个字:从后往前先换大就是从后往前扫,1的时候 从最大的可能中先替换3,然后替换2。这个规律就是观察出的,比较好理解。因为“从后往前先换大”的时候,把最大的放在的最后,这样可能就节省了下次的排序。具体代码如下:/*ID: awsd1231PROG: sort3 LANG: C++*/#include...
分类:
其他好文 时间:
2015-06-02 10:52:33
阅读次数:
90