随笔分类 -  04. . . . . |算法设计-构造

UVA 11925:Generating Permutations(冒泡排序 Grade D)
摘要:VJ题目链接题意:n个数(n#include #include using namespace std;#define n 1023int a[n+10];int n;int hd;bool check() { for (int i = 1; i a[(hd+1)%n] && (!(a[hd... 阅读全文

posted @ 2014-10-01 14:05 ShineCheng 阅读(317) 评论(0) 推荐(0)

uva 1611:Crane(构造 Grade D)
摘要:题目链接题意:一个序列,你可以选择其中偶数长度的一段,然后中间切开,左右两段交换。现给你一个1~n的某个排列,求一个交换方案,使得排列最终有序。(交换次数 #include #include #include #include using namespace std;#define N 10100i... 阅读全文

posted @ 2014-09-26 11:57 ShineCheng 阅读(283) 评论(0) 推荐(0)

导航