- 博客(8)
- 收藏
- 关注
原创 POJ2362(DFS)
DescriptionGiven a set of sticks of various lengths, is it possible to join them end-to-end to form a square?InputThe first line of input contains N, the number of test cases. Ea
2015-07-30 11:51:42 616
原创 HDU1501(dfs)
#include#include#include#define maxn 205using namespace std;int len1,len2,len3;int vis[maxn][maxn];char str1[maxn],str2[maxn],str3[maxn*2];bool dfs(int cur1, int cur2, int cur3){ if(cur
2015-07-29 00:16:45 3247
原创 CSU1660(深搜)
思路:对每个点深搜,搜到底,记录每次访问点时的深度,若能找到一个点先后两次访问深度差为K,则输出YES;找不到,则输出NO。#include#include#includeusing namespace std;int tag = 0;int arr[55][5],rec[55];int N,M,K;void dfs(int lastpoint, int x, in
2015-07-28 23:55:05 750
原创 ZOJ1008(深搜)
思路:暴搜,枚举每个位置的卡牌,直到找到结果为止。要注意的是合重,相同的卡牌合并在一起,记录数量,否则很容易超时。#includeusing namespace std;struct Node{ int u,r,d,l,len;}node[25];int n,sum,tmp,tag;int map[5][5];void dfs(int index){
2015-07-28 23:48:22 830
原创 ZOJ1204(dfs)
思路:输出顺序的确定:先对数据进行升序排列,再分别对不同长度的结果进行深搜,同时更新记录输出结果的数组。#include#include#include#define maxn 32using namespace std;int len, tmp,tag=0;int rec[maxn], ans[maxn];void dfs(int start, int sum,
2015-07-28 23:41:20 1022 1
原创 HDU3400(三分)
思路:设a为AB上一点,d为CD上一点,分别对a到A的距离和d到D的距离三分(对应的时间的变化均为凹函数),每次先枚举a的距离,再对d到D 的距离三分出此时对应的最小时间,直到a到A的距离枚举完,得到最小时间。#include#include#include#include#include#define eps 1e-8using namespace std;stru
2015-07-28 23:26:23 614
原创 POJ3258(二分)
思路:二分最短距离,计算对应的移动rocks 的个数。#include#include#define maxn 50005using namespace std;int arr[maxn], rec[maxn], N;int getsum(int x){ int cou = 0,tmp = 0; for(int i = 0; i N; i++)
2015-07-28 23:17:46 440
原创 HDU2141(二分)
DescriptionGive you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the formula Ai+Bj+Ck
2015-07-28 22:54:17 505
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人