随笔分类 -  搜索

摘要:#include#include#include#include#include#includeusing namespace std;char str[100];int mat[30][30];int vis[30][30];int ok;bool isok(int now,int next){ ... 阅读全文
posted @ 2015-07-28 00:53 sola94 阅读(195) 评论(0) 推荐(0)
摘要:#include#include#include#include#include#includeusing namespace std;int n,m,t;int sx,sy;int ex,ey;int ok;char mat[10][10];int vis[10][10];int op[4][2]... 阅读全文
posted @ 2015-07-26 23:15 sola94 阅读(126) 评论(0) 推荐(0)
摘要:#include#include#include#include#includeusing namespace std;int ch[20];int op[4][2]={1,0, -1,0, 0,1, 0,-1};int mat[200000];int vis[200000];void init_c... 阅读全文
posted @ 2015-07-26 23:12 sola94 阅读(114) 评论(0) 推荐(0)
摘要:#include#include#include#includeusing namespace std;int a[20];int ans[20];int num[200];struct Mark{ int shu,rt;};Mark mark[20];int ok;int n,t;int c... 阅读全文
posted @ 2015-07-26 23:09 sola94 阅读(107) 评论(0) 推荐(0)
摘要:#include#include#include#include#includeusing namespace std;char mat[50][50][50];int vis[50][50][50];int op[6][3]={0,-1,0, 0,1,0, 1,0,0, -1,0,0 ,0,0,1... 阅读全文
posted @ 2015-07-26 23:07 sola94 阅读(92) 评论(0) 推荐(0)
摘要:#include#include#include#includeusing namespace std;int mat[200][200];int vis[200][200];int ans,n,m,rt;int op[4][2]={0,-1,0,1,1,0,-1,0};bool isok(int ... 阅读全文
posted @ 2015-07-20 11:04 sola94 阅读(108) 评论(0) 推荐(0)
摘要:题意:给出四张扑克牌 问能否算出24思路:http://blog.csdn.net/xingyeyongheng/article/details/11137631 其实这题只有两种运算顺序 1(a@b)@c@d 2 (a@b)@(c@d) 所以只需要把数字和运算符全排列遍历一... 阅读全文
posted @ 2015-05-11 20:37 sola94 阅读(175) 评论(0) 推荐(0)
摘要:#include#include#include#includeusing namespace std;char a[1000+100];int vis[1000+100];int n;int cnt;int ok;bool huiwen(){ int l=0; int r=strlen... 阅读全文
posted @ 2015-04-21 20:17 sola94 阅读(88) 评论(0) 推荐(0)
摘要:题意:一共要吃n顿饭 公款m元 如果公款大于等于饭局所需费用 就全用公款 如果小于就自费 求最后能用的公款为多少思路: dfs(i - 1, val + dp[i]); dfs(i - 1, val);#include #include #include #include using namesp... 阅读全文
posted @ 2015-04-15 20:31 sola94 阅读(99) 评论(0) 推荐(0)
摘要:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1536题意: 输入n个只为 0或1 的数 形成一个排列 再输入m个数 每个数代表 目标排列 (样例 1 0 0 1 0 1 1 3 2 目标排列有可能为 1 ... 阅读全文
posted @ 2015-03-26 16:43 sola94 阅读(180) 评论(0) 推荐(0)
摘要:#include #include #include#includeusing namespace std;struct Node{ int x,y; int rt;};Node node[200];int n,m;int cnt,gcnt,ans,ok,temp;char mat[12][12... 阅读全文
posted @ 2015-03-20 17:47 sola94 阅读(104) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/510/problem/B题意: n行 每行m个颜色 问相同的颜色能否构成环思路: 对没vis过的位置dfs 一直到满足条件为止#include#include#include#includeusing namespace std;char... 阅读全文
posted @ 2015-03-05 22:33 sola94 阅读(139) 评论(0) 推荐(0)
摘要:之前没有考虑到 两层都是 # 的情况#include#include#include#include#include#include#include#include#include#define mem(a,b) memset(a,b,sizeof(a))using namespace std;in... 阅读全文
posted @ 2015-02-20 21:10 sola94 阅读(82) 评论(0) 推荐(0)
摘要:#include#include#include#includeusing namespace std;int vis[120][120];int vl,vr;int ok;int key;struct node{ int l,r; int fa; int op;};node st... 阅读全文
posted @ 2015-02-12 01:37 sola94 阅读(122) 评论(0) 推荐(0)
摘要:题意: 公主被关在 a位置 她的朋友在r位置 路上x位置有恶魔 遇上恶魔花费2 时间 否在时间花费 1 时间 问 最短多少时间 找到公主思路: bfs+ 优先队列(时间短的先出列)#include#include#include#include#include#includeusi... 阅读全文
posted @ 2015-01-28 00:26 sola94 阅读(155) 评论(0) 推荐(0)
摘要:#include#include#include#includeusing namespace std;char mat[20][20];int ans[15];int n;bool ok(int x,int y){ int tx,ty; int ans[15]; int temp... 阅读全文
posted @ 2015-01-25 01:22 sola94 阅读(110) 评论(0) 推荐(0)
摘要:#include#include#include#includeusing namespace std;char mat[50][50];int n,m;int ans;int op[4][2]={0,1,0,-1,1,0,-1,0};bool ok(int x,int y){ if(0<=x... 阅读全文
posted @ 2015-01-25 01:21 sola94 阅读(97) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1716考到题目直接套 next_permutation 没有注意到0不能为首位 结果wa了一整天输出结构也略有些小坑#include#include#include#include#includeusing nam... 阅读全文
posted @ 2015-01-23 10:08 sola94 阅读(211) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1274思路: 找到匹配的区间 之后dfs#include#include#include#include#includeusing namespace std;char str[300];void dfs(int ... 阅读全文
posted @ 2015-01-22 15:55 sola94 阅读(158) 评论(0) 推荐(0)
摘要:#include#include#include#includeusing namespace std;typedef int State[9];const int MAXSTATE=1000000;State st[MAXSTATE],goal;//int dist[MAXSTATE];int v... 阅读全文
posted @ 2014-12-23 19:05 sola94 阅读(137) 评论(0) 推荐(0)