2012年4月10日
摘要: /* Name: 日期计算 Author: Try_86 Date: 10/04/12 21:42*/#include <cstdio>#include <iostream>using namespace std;int days[13] = {0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};bool isLeap(int year) {//判断闰年 if ((year%400==0) || (year%4==0&&year%100!=0)) return true; return fa 阅读全文
posted @ 2012-04-10 21:45 Try86 阅读(324) 评论(0) 推荐(0)
摘要: /* Name: 数学题 Author: Try_86 Date: 10/04/12 20:56*/#include <cstdio>#include <cstring>#include <iostream>using namespace std;int b;char a[1005];int solve() { int ans = 0; for (int i=0; a[i]; ++i) ans = (ans * 10 + a[i] - '0') % b; return ans; }int main() { while (scanf(" 阅读全文
posted @ 2012-04-10 20:58 Try86 阅读(151) 评论(0) 推荐(0)
摘要: /* Name: 并查集 Author: Try_86 Date: 10/04/12 20:11*/#include <cstdio>#include <iostream>using namespace std;const int M = 1000;int p[M], sum;void init(int n) { for (int i=1; i<=n; ++i) p[i] = i; return ;}int find(int x) { if (p[x] != x) p[x] = find(p[x]); return p[x];}void join(int x, . 阅读全文
posted @ 2012-04-10 20:12 Try86 阅读(178) 评论(0) 推荐(0)
摘要: /* Name: 最小生成树(kruskal) Author: Try_86 Date: 10/04/12 19:51*/#include <cstdio>#include <cstdlib>#include <iostream>using namespace std;const int M = 700;int p[27], sum;struct edge { int a; int b; int w;}e[M];int cmp(const void *a, const void *b) { return (*(edge *)a).w - (*(edge *) 阅读全文
posted @ 2012-04-10 19:53 Try86 阅读(239) 评论(0) 推荐(0)
摘要: /* Name: 最小生成树(kruskal) Author: Date: 10/04/12 19:17*/#include <math.h>#include <cstdio>#include <iostream>using namespace std;const int M = 5050;int p[101], sum;struct edge { int a; int b; double dis;}e[M];struct point { double x; double y;}po[101];int cmp(const void *a, const v.. 阅读全文
posted @ 2012-04-10 19:20 Try86 阅读(225) 评论(0) 推荐(0)
摘要: /* Name: 最小生成树(kruskal) Author: Try_86 Date: 10/04/12 18:51 Description: 不符合题意所述的距离不加进边集中,然后套用kruskal就可以了 */#include <cmath>#include <cstdio>#include <cstdlib>#include <iostream>using namespace std;const int M = 5050;int p[M], sum;struct edge { int a; int b; double dis;}e[M]; 阅读全文
posted @ 2012-04-10 18:55 Try86 阅读(286) 评论(0) 推荐(0)
摘要: /* Name: hdu1863畅通工程 Author: Try86 Date: 10/04/12 12:43 Description: 最小生成树(kruskal) */#include <cstdio>#include <iostream>using namespace std;const int M = 5050;int p[M], sum; //sum统计顶点个数 struct edge { int a; int b; int w;}e[M];int cmp(const void *a, const void *b) { return (*(edge ... 阅读全文
posted @ 2012-04-10 12:47 Try86 阅读(909) 评论(0) 推荐(0)