- 博客(11)
- 收藏
- 关注
原创 Prime Path POJ - 3126 (素数,bfs)
可以说这个题思路是非常简单了,打素数表,再广搜。。。一些不好懂的都在代码里注释了http://poj.org/problem?id=3126 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<queue> #include&...
2018-02-27 16:17:54 209
原创 Lake Counting POJ - 2386(水池
dfs入门题看有几块W水池,一开始不理解题意,就是w周围8个方向如果还有w那和原本的w算一块水池原题链接http://poj.org/problem?id=2386ac代码#include<stdio.h> char a[105][105]; int n,m; int ans; void dfs(int x,int y) { for(int dx=-1;dx<=1;dx+...
2018-02-27 08:55:45 238 1
原创 Parentheses Balance UVA - 673(空格字符串)
括号匹配。坑的就是空字符串,,空串!空串!空串 附上参考资料。c/c++输入带空格的字符串用法总结http://blog.csdn.net/zhouwei1221q/article/details/44887899 原题链接https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show...
2018-02-27 08:33:22 217
原创 find the safest road HDU - 1596
城市与城市之间有安全指数,指数越大越安全,0即两城市不连通,安全度等于路线的安全指数相乘。输入两城市间最大的安全度。题目输入先输入连接矩阵,再输入起点终点。链接http://acm.hdu.edu.cn/showproblem.php?pid=1596ac:#include<cstdio> #include<iostream> #include<algorithm&g...
2018-02-25 14:59:24 158
原创 Bad Cowtractors POJ - 2377
用最短路的方法找最长路。。。哎黑心商家没有好结果啊链接:Bad Cowtractors POJ - 2377 ac:#include<iostream> #include<algorithm> using namespace std; const int maxn = 1000005; struct node{ int from,to,dis; }edg...
2018-02-25 14:14:43 131
原创 A strange lift HDU - 1548
一个电梯,每一层可以上行或下行不同的层数,问从一层到另一层需要按几次按键原题:http://acm.hdu.edu.cn/showproblem.php?pid=1548ac:#include<cstdio> #include<cstring> const int N=210, INF=0x3f3f3f3f; //无穷大只能定义成这个。。。。。999999之类的不行...
2018-02-25 14:10:13 151
原创 HDU Today HDU - 2112
涉及到map容器的使用使用map头文件:#include <map> //注意,STL头文件没有扩展名.hmap对象是模板类,需要关键字和存储对象两个模板参数:map<int,string> number,name;原题连接http://acm.hdu.edu.cn/showproblem.php?pid=2112ac代码:#include <iostream>...
2018-02-25 13:50:15 188
原创 畅通工程续 HDU - 1874
跟最短路一样,多了一个不成立的判断原题连接:http://acm.hdu.edu.cn/showproblem.php?pid=1874#include<cstdio> #include<cstring> const int N=105, INF=9999999; int d[N], w[N][N],vis[N],n,m; void Dijkstra(int s){ ...
2018-02-25 12:04:23 132
原创 最短路 HDU - 2544
//1到N的距离原题连接:http://acm.hdu.edu.cn/showproblem.php?pid=2544#include<cstdio> #include<cstring> const int N=105, INF=9999999; int d[N], w[N][N],vis[N],n,m; void Dijkstra(int s){ memset(...
2018-02-25 12:00:55 159
原创 MPI Maelstrom POJ - 1502
//是一个点到其他所有点的最短时间,而且是并行(同时进行)所以找到到每个点的最短时间其中最大的就行 原题http://poj.org/problem?id=1502 #include<cstdio> #include<iostream> #include<cstring> #include<algorithm> using namespace s...
2018-02-14 00:45:26 190
原创 POJ - 2387 - Til the Cows Come Home
/*放假浪了几天重新敲敲之前写的题顺便写写博客莫名其妙的是竟然wa了好几次。。。*/最短路径模板题,给目的地求最短路径原题http://poj.org/problem?id=2387ac代码:#include<cstdio> #include<cstring> const int N=2000,INF=0x3f3f3f3f; int d[N],w[N][N],vis[N],...
2018-02-13 22:27:40 144
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人