会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
ACLJW
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
8
···
18
下一页
2018年8月11日
806:Spatial Structures
摘要: Spatial Structures#includeusing namespace std;const int maxn = 64 + 5;int n,len;int seq[maxn*maxn];char img[maxn][maxn];struct node{ ...
阅读全文
posted @ 2018-08-11 23:26 ACLJW
阅读(169)
评论(0)
推荐(0)
2018年8月10日
1600:Patrol Robot
摘要: Patrol Robot这个题还是DFS,不过每个状态除了记录位置之外,还要记录剩余穿越次数,这样一来就变成了三维DFS。对于值为1的点如果剩余穿越次数大于0且该状态未遍历过的话也可以访问。像这种四个方向的话用常量数组比较方便,没必要搞个二重循环,容易出bug。#in...
阅读全文
posted @ 2018-08-10 00:57 ACLJW
阅读(180)
评论(0)
推荐(0)
2018年8月9日
439:Knight Moves
摘要: Knight MovesBFS即可,字符串数组 size 定义成了 2 导致输入一直错误,应该是无法存入'\0' 引起的,待会儿再深究。#includeusing namespace std;const int maxn = 8;typedef pair P;int ...
阅读全文
posted @ 2018-08-09 23:10 ACLJW
阅读(140)
评论(0)
推荐(0)
712:S-Trees
摘要: S-Trees#includeusing namespace std;const int maxn = 7;int n,m,t,cnt = 0;char s[2];int a[maxn];char b[maxn];char leaf[int(pow(2,maxn))]...
阅读全文
posted @ 2018-08-09 22:11 ACLJW
阅读(91)
评论(0)
推荐(0)
2018年8月8日
536:Tree Recovery
摘要: Tree Recovery#includeusing namespace std;const int maxn = 30;struct node{ char c; struct node* l = NULL; struct node* r = NUL...
阅读全文
posted @ 2018-08-08 23:53 ACLJW
阅读(270)
评论(0)
推荐(0)
2018年8月7日
12171:Sculpture
摘要: Sculpture思路:将三维空间网格化,每个长方体占据的所有单元标记为1。求面积的话,DFS所有的单元,依次检查是上下左右前后六个方向上相邻单元是否为1,若否则是表面,面积加+1。求体积的话,从外面某个单元开始DFS,求出外面值为0的单元的个数,那么总单元个数 - ...
阅读全文
posted @ 2018-08-07 23:55 ACLJW
阅读(209)
评论(0)
推荐(0)
2018年8月6日
10562:Undraw the Trees
摘要: Undraw the Trees这题没啥说的,利用DFS进行先序遍历即可,注意 node 可以不是字母,然后 puts() 默认换行的,太久没用都忘了。。#includeusing namespace std;const int maxn = 200 + 5;int ...
阅读全文
posted @ 2018-08-06 23:37 ACLJW
阅读(130)
评论(0)
推荐(0)
2018年8月5日
10305:Ordering Tasks
摘要: Ordering Tasks这题比较简单,就是拓扑排序,而且肯定是有向无环图,直接DFS即可。注意数据读取,只要 n 和 m 有一个不为0即可。。。不考虑是否存在环:#includeusing namespace std;const int maxn = 100 + ...
阅读全文
posted @ 2018-08-05 00:29 ACLJW
阅读(99)
评论(0)
推荐(0)
2018年7月31日
816:Abbott's Revenge
摘要: Abbott's Revenge一些细节要特别注意#includeusing namespace std;const int maxn = 10;const char* dirs = "NESW";const char* turns = "FLR";struct No...
阅读全文
posted @ 2018-07-31 23:39 ACLJW
阅读(116)
评论(0)
推荐(0)
2018年6月2日
1103:Ancient Messages
摘要: Ancient Messages数一数就能发现,题目表中的6个符号从左到右依次有1,3,5,4,0,2个洞,各不相同。这样,只需要数一数输入的符号有几个“白洞”,就能准确地知道它是哪个符号了。至于具体实现,我的思路是:先确定一个符号,找到该符号的空洞个数然后将该符号“...
阅读全文
posted @ 2018-06-02 23:53 ACLJW
阅读(179)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
8
···
18
下一页
公告