堆的时间复杂度是建O(n),时间复杂度为堆排序O(NLogN),细节如以下的算法看到:#include using namespace std;void swap(int &i,int &j){ int temp=i; i=j; j=temp;}void shiftDown(int...
分类:
编程语言 时间:
2015-10-04 19:31:58
阅读次数:
162
题意:从x点到其他各点再返回,所有最短路径中的最长路径#include #include #include #include #include using namespace std;const int oo=100000007;struct node{ int u,v,w; int n...
分类:
其他好文 时间:
2015-10-04 15:53:28
阅读次数:
236
解题思路:简单宽搜,关键是剪枝。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const int maxn = 100005; 7 int vis[maxn]; //标记这个点是否走过 8 int n, k...
分类:
其他好文 时间:
2015-10-04 14:45:07
阅读次数:
163
解题思路:三维数组,简单宽搜,注意细节。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const int maxn = 35; 7 int dir[6][3] = {0, 0, 1, 0, 0, -1, 0...
分类:
其他好文 时间:
2015-10-04 13:33:32
阅读次数:
198
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace Test10 7 { 8 class Program 9 {10...
分类:
其他好文 时间:
2015-10-04 12:22:50
阅读次数:
202
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace Test09 7 { 8 class Program 9 {10...
分类:
其他好文 时间:
2015-10-04 12:19:56
阅读次数:
129
10.4CF 582AGCD Table贪心取最大。熟悉set大法。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 multiset S; 9 mult...
分类:
其他好文 时间:
2015-10-04 11:04:07
阅读次数:
172
A solution using additional spaces to solve a copy of the original board is easy. To get an in-place solution, we need to record the information of st...
分类:
其他好文 时间:
2015-10-04 01:31:44
阅读次数:
207
Your problem probably is that you haven'tinstalledpython. Meaning that, if you are using Windows, you have not downloaded the installer for Windows, t...
分类:
编程语言 时间:
2015-10-04 00:24:07
阅读次数:
295
用负二进制表示一个数,如21=1+4+16,当num>21时最大用64-32表示32,否则最大用16即可,当num=31时,31-32=-1,在转入处理负数的函数中 1 /*0.003s*/ 2 #include 3 #include 4 #include 5 #include 6 using...
分类:
其他好文 时间:
2015-10-03 23:04:08
阅读次数:
265