第一道Kruskal算法题#include #include #include using namespace std;#define max 505int f[max],maxw;struct edge{ int st,en,w;}ed[max*max/2];int find(int k){ if...
分类:
其他好文 时间:
2014-07-28 15:39:43
阅读次数:
181
第一份代码,TLE了#include#define MAX 100000+5int a[MAX];int main(){ int n,m,i,j,k,v; while( scanf("%d %d",&n,&m)!=EOF) { for(i=1;i#include#in...
分类:
其他好文 时间:
2014-07-28 15:06:53
阅读次数:
241
代码:#include #define MAX 26 typedef struct TrieNode{ int nCount; struct TrieNode *next[MAX];}TrieNode;TrieNode Memory[1000000];int allocp = 0;TrieNode ...
分类:
其他好文 时间:
2014-07-28 14:42:43
阅读次数:
176
第一题最小生成树#include #include using namespace std;#define max 501const int maxd =(1>t; while(t--){ cin>>n; for(int i=0;i>a[i][j]; a[i][i]=maxd; } bu...
分类:
其他好文 时间:
2014-07-28 02:56:30
阅读次数:
225
并查集简单题#include #include using namespace std;#define max 30010int f[max];int getf(int k){ while(k!=f[k]){ k=f[k]; } return k;}void combine(int a,int b)...
分类:
其他好文 时间:
2014-07-27 23:31:09
阅读次数:
193
素数打表,加上sum[i]数组表示1-i中有多少个素数二分查找#include #include using namespace std;#define max 1000005int phi[max],sum[max];int a,b,k;void getp(){ for(int i=2;i>a>>...
分类:
其他好文 时间:
2014-07-27 23:27:19
阅读次数:
355
#include #include 考查了对next数组的了解using namespace std;#define max 1000005int next[max],l,ans[max];char s[max];void getNext(){ int j,k; next[0]=-1; j=0;k=...
分类:
其他好文 时间:
2014-07-27 23:26:49
阅读次数:
174
LeetCode: Max Points on a LineGiven n points on a 2D plane, find the maximum number of points that lie on the same straight line.地址:https://oj.leetcod...
分类:
其他好文 时间:
2014-07-27 23:22:59
阅读次数:
289
public class MyVolumnView extends View { int count_dark = 7; final int MAX_COUNT = 15; Paint paint; Bitmap dark; Bitmap light; final...
分类:
其他好文 时间:
2014-07-27 23:20:29
阅读次数:
261
状态压缩 动态规划DP[111.....1]=1表示所有鱼都在的几率为10代表已经挂了的,1代表没挂;#include "stdio.h"#define max 10;i--){ int bit=bitcount(i); if(bit==1)continue; double p=2*dp[i]...
分类:
其他好文 时间:
2014-07-27 23:19:49
阅读次数:
316