![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
搜索
文章平均质量分 67
ccshijtgc
这个作者很懒,什么都没留下…
展开
-
HDU 2102A计划(BFS)
A计划#include <stdio.h>#include <string.h>#include <queue>#include <algorithm>using namespace std;struct node { int x, y, floor; int step;};int t, n, m, lim;int...原创 2018-06-29 09:53:04 · 99 阅读 · 0 评论 -
POJ 3895 Cycles of Lanes(DFS)
Cycles of Lanes#include <cstdio>#include <cstdlib>#include <iostream>#include <cstring>#include <vector>using namespace std;const int maxn = 4500;vector<int&g...原创 2018-06-25 11:19:42 · 110 阅读 · 0 评论 -
POJ 1321 棋盘问题(DFS)
棋盘问题#include <iostream>#include <string.h>#include <algorithm>#include <stdio.h>using namespace std;int n, k, ans;char map[10][10];bool line[10];void dfs(int col, int n...原创 2018-06-17 08:36:01 · 119 阅读 · 0 评论 -
poj1186 方程的解数(dfs + hash)
poj1186 方程的解数普通的dfs会超时,150^6,分成前半边 后半边来搜索,150^3可以接受了#include<iostream>#include<cstdio>#include<cstring>using namespace std;const int MAX = 4000000;struct Hash { int val; ...原创 2018-06-09 12:53:27 · 397 阅读 · 0 评论 -
hdu 1560 DNA sequence(IDA)
hdu 1560 DNA sequence#include <bits/stdc++.h>using namespace std;int n,deep;char c[10] = "ACGT";struct node { char s[10]; int len;} a[10];int pos[10];//记录第i个序列正在使用第几个位置int get_...原创 2018-06-09 10:41:40 · 150 阅读 · 0 评论 -
HDU 2610 Sequence one(DFS)
Sequence one#include <cstring>#include <cstdio>#include <algorithm>using namespace std;int n, p, a[1005];int cnt = 0, len;bool flag;struct node { int num, pos;//num为值, p...原创 2018-06-16 08:03:32 · 149 阅读 · 0 评论 -
HDU 2410 Barbara Bennett's Wild Numbers(枚举数学加速)
Barbara Bennett's Wild Numbers#include <bits/stdc++.h>char w[20], x[20];int get(int i, int temp, int len) { int j; for(j = i+1; j < len; j++) { if(w[j] == '?') ...原创 2018-06-15 17:33:03 · 151 阅读 · 0 评论 -
HDU 2307 POJ 2639 Necklace Decomposition(暴力)
Necklace Decomposition Necklace Decomposition#include <bits/stdc++.h>using namespace std;bool necklace(string s) { string x; int n = s.size(); for(int i = 1; i < n; i++) { ...原创 2018-06-15 17:01:17 · 362 阅读 · 0 评论 -
POJ 2251 Dungeon Master(BFS)
Dungeon Master#include<iostream>#include<string.h>#include<string>#include<stdio.h>#include<queue>using namespace std;int l, r, c,ans;int map[32][32][32];bool v...原创 2018-06-23 10:30:02 · 106 阅读 · 0 评论 -
HDU 1951 Vase collection(DFS)
Vase collection#include<iostream>#include<cstdio>#include<cmath>#include<cstring>using namespace std;typedef long long LL;LL state[40];//记录每种形状出现多少种装饰int ans;int chec...原创 2018-06-15 15:47:39 · 145 阅读 · 0 评论 -
HDU 1167 Station Balance(DFS)
Station Balance#include <bits/stdc++.h>using namespace std;const int maxC = 8;const int maxS = 16;struct Centifuge { int num;//装了几件样品 int totSum;//样品的总重量 int load[3];//每个房间装载的样...原创 2018-06-15 11:49:33 · 188 阅读 · 0 评论 -
hdu 2612 Find a way (BFS)
hdu 2612 Find a way#include <stdio.h>#include <string.h>#include <queue>#include <algorithm>using namespace std;const int maxn = 210;char board[maxn][maxn];//地图bool vi...原创 2018-06-08 12:45:43 · 117 阅读 · 0 评论 -
HDU 1515 Anagrams by Stack(DFS)
Anagrams by Stack#include <bits/stdc++.h>using namespace std;const int maxn = 200;char s[maxn];char t[maxn];char st[maxn];char ans[2*maxn];int len;int top;int idx;void dfs(int ls, i...原创 2018-06-15 09:17:31 · 137 阅读 · 0 评论 -
POJ 2258 The Settlers of Catan(DFS)
The Settlers of Catan#include <cstdio>#include <cstdlib>#include <iostream>#include <cstring>#include <vector>using namespace std;const int maxn = 30;vector<i...原创 2018-06-25 12:54:15 · 180 阅读 · 0 评论 -
HDU1010 Tempter of the Bone(DFS)
HDU Tempter of the Bone其中t - tx味剩余的步数或者说时间,另其为T(abs(x-ex)+abs(y-ey))为剩余步数,另其为S如果走偶数步要求的时间是奇数,或者走奇数步要求的时间是偶数,都明显不可行而轻易得出奇数-偶数 = 奇数,反之亦然而奇数-奇数= 偶数,偶数-偶数=偶数所以tem必须为偶#include <bits/stdc++.h>using ...原创 2018-06-11 09:56:37 · 111 阅读 · 0 评论 -
HDU 3309 Roll The Cube(BFS)
Roll The Cube#include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#include <queue>using namespace std;int dir[4][2] = {0,1,1,0,0,-1,-1,0};char...原创 2018-06-28 16:34:20 · 164 阅读 · 0 评论 -
POJ 1579 Function Run Fun(记忆化)
Function Run Fun#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;int dp[25][25][25];int dfs(int a,int b,int c){ if(a <= 0 || b <= 0 || c...原创 2018-06-28 13:44:20 · 196 阅读 · 0 评论 -
HDU 4957 Play Game(记忆化)
Play Game#include <cstdio>#include <cstdlib>#include <iostream>#include <cstring>using namespace std;const int maxn = 20 + 5;int a[maxn];int b[maxn];int suma[maxn], ...原创 2018-06-28 13:22:33 · 94 阅读 · 0 评论 -
POJ 1088滑雪(记忆化)
滑雪#include <cstdlib>#include <cstdio>#include <cstring>#include <iostream>using namespace std;const int maxr = 110;int map[maxr][maxr];int dp[maxr][maxr];int r, c, h;...原创 2018-06-28 10:20:35 · 102 阅读 · 0 评论 -
HDU 1078 FatMouse and Cheese(记忆化)
FatMouse and Cheese#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;int n, k, dp[105][105], a[105][105];int to[4][2] = {1,0,-1,0,0,1,0,-1};int val...原创 2018-06-27 17:45:46 · 88 阅读 · 0 评论 -
HDU 1978 How many ways(记忆化)
How many ways#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;int n, m, dp[105][105], a[105][105];int valid(int x,int y) { if(x < 1 || x >...原创 2018-06-27 17:23:42 · 133 阅读 · 0 评论 -
HDU 2918 Tobo or not Tobo(IDA*)
Tobo or not Tobo#include <iostream>#include <cstdio>#include <cstring>#include <queue>using namespace std;char ch[20];char str[10][10],Map[10][10];int want;void init...原创 2018-06-20 13:49:05 · 187 阅读 · 0 评论 -
HDU 1667 The Rotation Game(IDA*)
The Rotation Game#include <iostream>#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;int map[10][10];int _hash[8] = {3, 5, 3, 5, 5, 3, 5, 3};...原创 2018-06-20 12:34:31 · 156 阅读 · 0 评论 -
HDU 2234 无题I(IDA)
无题I#include <stdio.h>#include <iostream>#include <string.h>#include <algorithm>using namespace std;int map[5][5];int deep;bool check_row() { //检查行 int i; for(i...原创 2018-06-20 09:56:05 · 188 阅读 · 0 评论 -
HDU 5025 Wang Xifeng's Little Plot(DFS)
Wang Xifeng's Little Plot#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int MAXN = 100+10;int n,ans;char map[MAXN][...原创 2018-06-19 20:33:23 · 135 阅读 · 0 评论 -
HDU 2616 Kill the monster(DFS)
Kill the monster#include <bits/stdc++.h>using namespace std;const int maxn = 15;int n, totalBlood;int nomKill[maxn], maxKill[maxn];int vis[maxn];int ans;bool ok;//cnt:已经用了多少spell//lef...原创 2018-06-19 17:18:28 · 108 阅读 · 0 评论 -
HDU 2614 Beat(DFS)
Beat#include <bits/stdc++.h>using namespace std;#define MAX(a, b) (((a) > (b))?(a):(b))#define MAXN 15int data[MAXN+1][MAXN+1]; // data[i][j]:做完第i道题后,做第j道题需要的时间int visit[MAXN+1];int...原创 2018-06-19 10:14:11 · 89 阅读 · 0 评论 -
HDU 1456 Transportation(DFS)
Transportation#include <bits/stdc++.h>using namespace std;#define maxm 23#define maxn 8int cap, n, m;//cap表示容量,n表示站数,m表示订单数int ans;//最后结果int down[maxn];//表示在i站下车的人数struct Order { i...原创 2018-06-14 16:45:42 · 207 阅读 · 0 评论 -
HDU 1455 Sticks(DFS)
Sticks#include <bits/stdc++.h>using namespace std;const int maxn = 70;int n, sumv, target, aim;//target表示目标的棍子个数,aim表示目标的棍子长度int stick[maxn], vis[maxn];bool cmp(int a, int b) { return...原创 2018-06-14 14:52:08 · 118 阅读 · 0 评论 -
HDU 2181 哈密顿绕行世界问题(DFS)
哈密顿绕行世界问题#include <bits/stdc++.h>using namespace std;const int maxn = 25;int graph[maxn][maxn];int path[maxn];int vis[maxn];int m;int No;void dfs(int cur, int cnt, int idx) { if(cu...原创 2018-06-14 10:02:49 · 113 阅读 · 0 评论 -
计蒜客 一维坐标的移动(bfs搜索)
计蒜客 一维坐标的移动#include <bits/stdc++.h>using namespace std;#define maxn 5005bool visited[maxn];int n, A, B;int step = 0;bool ok = false;/*@startx:x坐标@starty:y坐标*/void findPath(int start,...原创 2018-06-04 17:15:05 · 777 阅读 · 0 评论 -
计蒜客 走迷宫2(bfs搜索)
计蒜客 走迷宫2#include <bits/stdc++.h>using namespace std;#define maxn 110int n, m;char board[maxn][maxn];bool visited[maxn][maxn];int dx[4] = {-1, 1, 0, 0};int dy[4] = {0, 0, -1, 1};bool ok ...原创 2018-06-04 16:50:18 · 498 阅读 · 0 评论 -
HDU 2952 Counting Sheep(DFS)
Counting Sheep#include <bits/stdc++.h>const int maxn = 105;char maps[maxn][maxn];int dx[4] = {-1,1,0,0};int dy[4] = {0,0,-1,1};int w, h;int cnt;bool in(int x, int y) { return x >...原创 2018-06-11 16:30:13 · 90 阅读 · 0 评论 -
HDU 1312 Red and Black(DFS)
Red and Black#include <bits/stdc++.h>const int maxn = 105;char maps[maxn][maxn];int dx[4] = {-1,1,0,0};int dy[4] = {0,0,-1,1};int w, h;int cnt;bool in(int x, int y) { return x >...原创 2018-06-11 16:06:18 · 95 阅读 · 0 评论 -
HDU 1518 Square(DFS)
Square#include <bits/stdc++.h>using namespace std;int n;bool ok;const int max_n = 25;int lens[max_n];int used[max_n];int target;void dfs(int idx, int cur, int pos) {//idx:当前拼到了第idx根, c...原创 2018-06-11 14:59:31 · 84 阅读 · 0 评论 -
计蒜客 金字塔数独(dfs搜索)
计蒜客 金字塔数独#include <bits/stdc++.h>using namespace std;#define maxn 9int board[maxn][maxn];int points[maxn][maxn] = { {6,6,6,6,6,6,6,6,6}, {6,7,7,7,7,7,7,7,6}, {6,7,8,8,8,8,8,7,6}...原创 2018-06-04 16:08:15 · 708 阅读 · 0 评论 -
计蒜客 八皇后问题(dfs搜索)
计蒜客 八皇后问题#include <bits/stdc++.h>using namespace std;using namespace std;#define maxn 8int board[maxn][maxn];int maxSum = 0;//值:第0 1 2 3 4....(数组下标)列的皇后在第几行int queenAtRows[maxn] = {-1}...原创 2018-06-04 15:52:12 · 277 阅读 · 0 评论 -
计蒜客 正方形(dfs搜索)
计蒜客 正方形#include <bits/stdc++.h>using namespace std;int n;bool ok = false;const int max_n = 25;int lens[max_n];int used[max_n];int target;void dfs(int idx, int cur, int pos) {//idx:当前拼到...原创 2018-06-04 15:35:46 · 386 阅读 · 0 评论 -
计蒜客 等边三角形(dfs搜索)
计蒜客 等边三角形#include <bits/stdc++.h>using namespace std;int n;bool ok = false;const int max_n = 25;int lens[max_n];int used[max_n];int target;void dfs(int idx, int cur, int pos) {//idx:当前...原创 2018-06-04 15:29:32 · 486 阅读 · 0 评论 -
计蒜客 方程的解个数(dfs搜索)
方程的解个数#include <bits/stdc++.h>using namespace std;const int max_n = 10;int coeffs[max_n];int exps[max_n];int n, m;int memory[160][10];int ans = 0;void preProc() { for(int i = 1; i...原创 2018-06-04 14:35:31 · 400 阅读 · 0 评论