dfs+贪心解法 摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int n,k;int dfs(int t){ if(t<=n) { …… 题解列表 2023年03月25日 0 点赞 0 评论 584 浏览 评分:0.0
抓住那头牛,深搜 ```#includeusingnamespacestd;intn,k;//深度搜索intdfs(intt)//n到t的时间{//不能乘车if(t>n>>k;ints=0;if(n==0)//特判一下,如果n==0,2x没有用,抓牛过程中无论如何至少会往前走一步{n++;s++;}s+=dfs(k); 题解列表 2023年03月20日 0 点赞 0 评论 806 浏览 评分:9.9
抓住那头牛(广搜) 摘要:解题思路:利用广搜注意事项:参考代码://利用广度优先搜索 //利用广度优先搜索 #include <iostream> #include <queue> using namespace s…… 题解列表 2023年03月31日 1 点赞 0 评论 1052 浏览 评分:9.9
3048: 抓住那头牛 摘要:```cpp #include using namespace std; int n,k; int dfs(int t) { if(t>n>>k; int s=0; …… 题解列表 2023年04月04日 0 点赞 0 评论 912 浏览 评分:9.9
3048: 抓住那头牛 摘要:解题思路: BFS: 三种移动方向 + 1, - 1, 2 * x注意事项:参考代码:#include<iostream> #include<cstring> using namespace st…… 题解列表 2024年04月08日 1 点赞 0 评论 770 浏览 评分:9.9
抓住那头牛! 双向BFS #双向BFS######更小的时间复杂度,更少的栈空间,更多的代码######tip:小题大做``````cpp#include#defineULLunsignedlonglong#defineLLlonglong#definePIIpairusingnamespacestd;constintN=3* 题解列表 2024年09月12日 0 点赞 1 评论 528 浏览 评分:9.9