- 博客(18)
- 资源 (7)
- 收藏
- 关注
原创 hdu1878 欧拉回路
#include #include #include #include using namespace std;const int N = 1000;int pre[N];int findd(int x){ int r = x; while(r != pre[r]) r = pre[r];
2016-01-31 17:51:20 310
原创 hdu1213 How Many Tables
#include #include #include #include using namespace std;const int N = 1000;int pre[N];int findd(int x){ int r = x; while(r != pre[r]) r = pre[r];
2016-01-31 15:04:23 297
原创 hdu1232 畅通工程 && poj2524 Ubiquitous Religions(并查集裸)
http://acm.hdu.edu.cn/showproblem.php?pid=1232题意:给你n个点m条边,求再需要添加多少条边就可以变成一个连通图。思路:并查集裸体,思路看并查集详解。#include #include #include #include #include using namespace std;typedef long
2016-01-31 10:22:19 423
原创 hdu5137 How Many Maos Does the Guanxi Worth
#include #include #include #include using namespace std;const int INF = 1 const int N = 1005;int path[N][N], path0[N][N];int m, n;int Min(int a, int b){ return
2016-01-30 17:43:44 470
原创 hdu2074&&牛客oj 叠框(模拟)
本人做题全靠心情,自我感觉一种题通了且有模板可循就总结至这里,不定期更新,注意点一般都写在注释,参考自认为典型题(不是刁难变相题),望诸神不喜轻喷勿拉黑1、弗洛伊德算法(参考hdu1874)#include #include #include #include using namespace std;const int INF = 1 const int N
2016-01-27 10:40:39 432
原创 hdu5600 N bulbs
#include #include int main(){ int i, j, T, N, num, time; scanf("%d", &T); while(T--) { time = 0; scanf("%d", &N); scanf("%d", &num); i
2016-01-25 12:50:59 419
原创 hdu3631 Shortest Path
#include #include #include #include using namespace std;const int INF = 1const int N = 1002;int path[N][N];bool vis[N];int m, n, q;int Min(int a, int b){ ret
2016-01-24 21:05:28 386
原创 hdu5611 Baby Ming and phone number
#include #include const int h1[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};const int h2[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};int tra(char c) { return c -
2016-01-24 13:21:23 485
原创 hdu5610 Baby Ming and Weight lifting(暴力)
http://acm.hdu.edu.cn/showproblem.php?pid=5610思路:数据量小,直接暴力枚举。#include #include int main(){ int i, j, T, a, b, C, i0, j0; scanf("%d", &T); while(T--) { scanf(
2016-01-24 09:10:42 930 2
原创 hdu1128 Self Numbers
#include #include #include #include using namespace std;int main(){ int i, num, num0; bool a[1000005]; memset(a, false, sizeof(a)); for(i = 1; i { nu
2016-01-23 17:50:01 453
原创 hdu2868 Neighbor Friend
#include #include #include using namespace std;const int N = 1002;bool path[N][N];bool path0[N][N];int m, n;void floyd(){ int i, j, k; for(i = 1; i
2016-01-19 20:01:28 366
原创 hdu1874 畅通工程续(裸Dijkstra)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1874思路:话说这题刚开始队列优先级搞错样例居然也能过,害得我找了半天错。。其他没什么好说的。。。#include <cstdio>#include <iostream>#include <algorithm>#include <stri...
2016-01-19 17:44:19 359
原创 hdu2544 最短路(三种基本最短路算法)
http://acm.hdu.edu.cn/showproblem.php?pid=2544题意:中文题求最短路。无负值。思路:主要是用来熟悉三种基本最短路算法。先来整体教程。总体而言,三种算法都是对点的不断松弛而找出最短路,而且最短路途中的任何节点都满足其为当前最短路。1、dijkstra算法:给一个讲的比较好的博客,尤其是里面的动态图可以多看。核心就是两个for,第一个
2016-01-19 16:24:29 1135
原创 hdu2066 一个人的旅行
#include #include #include #include using namespace std;const int INF = 1const int N = 1002;int maxx, minn;bool start[N], endd[N];int path[N][N];int floyd(){
2016-01-19 15:29:28 362
原创 hdu2550 百步穿杨
#include #include #include #include using namespace std;struct init{ int num, len;};bool cmp(init a, init b){ return a.len }int main(){ int t, N; in
2016-01-17 18:30:27 537
原创 hdu2161 Primes
#include #include #include int is_prime(int n){ if(n int m = floor(sqrt(n) + 0.5); for(int i = 2; i if(n % i == 0) return 0; return 1;}int main(){
2016-01-17 15:58:56 499
原创 hdu2549 壮志难酬
#include #include int main(){ int t, n, flag, i; scanf("%d", &t); while(t--) { char a[5000]; scanf("%s%d", a, &n); int len = strlen(a);
2016-01-15 22:08:04 472
原创 hdu2548 两军交锋
#include int main(){ int t; double u, v, w, l; scanf("%d", &t); while(t--) { scanf("%lf%lf%lf%lf", &u, &v, &w, &l); printf("%.3lf\n", l/(u+v)*w);
2016-01-15 19:57:45 389
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人