![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
蓝桥杯
0ne_
这个作者很懒,什么都没留下…
展开
-
大臣的旅费
%75的通过率。。。 #include <iostream> using namespace std; int n; int a,b,c; int net[1000][1000]; int vis[1000]; int sum[1000]; int ans; int max1=-99; void dfs(int x,int y,int count) { vis[x]=1; ...原创 2019-02-27 19:24:08 · 172 阅读 · 0 评论 -
连号区间数
题目描述 小明这些天一直在思考这样一个奇怪而有趣的问题: 在1~N的某个全排列中有多少个连号区间呢?这里所说的连号区间的定义是: 如果区间[L, R] 里的所有元素(即此排列的第L个到第R个元素)递增排序后能得到一个长度为R-L+1的“连续”数列,则称这个区间连号区间。 当N很小的时候,小明可以很快地算出答案,但是当N变大的时候,问题就不是那么简单了,现在小明需要你的帮助。 输...原创 2019-05-10 16:19:37 · 155 阅读 · 0 评论 -
出租
原题链接:https://pintia.cn/problem-sets/1107085952880697344/problems/1107088800007806976 开始用的long long输入,一个样例过不了,测试了00000000000,我的不对,所以改成string,但感觉电话号码没有这样的吧! #include <iostream> #include <bit...原创 2019-03-28 09:28:38 · 441 阅读 · 0 评论 -
危险系数
原题链接:http://www.dotcpp.com/oj/problem1433.html?sid=714312&lang=1#editor 这里我采用的是深搜的思想 #include <iostream> using namespace std; int net[1000][2000]; int vis[1000]; int ans,way[1000],cnt[100...原创 2019-02-27 13:09:11 · 766 阅读 · 0 评论 -
01背包
原题链接:http://www.dotcpp.com/oj/problem1924.html 动态规划,主要是这句dp[j]=max(dp[j],dp[j-w]+v);的理解 比如5这个包,它可以是1+4两个包,也可以是2+3两个包,所以进行了循环取最大值,因此其他的包里是最优解,所以5也是最优解。 #include <iostream> using namespace std...原创 2019-03-02 18:54:24 · 85 阅读 · 0 评论 -
Minesweeper
原题链接:http://www.dotcpp.com/oj/problem1096.html 主要是看懂题目,看懂其实就不难,大意是地雷的地方输出*,不是地雷的话就求出以自己为中心,自己附近的八个有几个雷,然后输出。 主要就是附近八个怎么求,用两个数组,或者像我一样用 for(int i=-1;i<=1;i++) for(int j=-1;j<=1;j++) 3*3个数...原创 2019-02-26 17:20:17 · 445 阅读 · 0 评论 -
兰顿蚂蚁
原题链接:http://www.dotcpp.com/oj/problem1429.html 比较笨重的一种写法,不过好歹自己写了很久,过了 #include <iostream> using namespace std; int m,n; int x,y,k,r,c; char s; int a[100][100]; int cnt; void dfs(int kx,int k...原创 2019-02-26 16:40:01 · 459 阅读 · 0 评论 -
剪格子
原题链接:http://www.dotcpp.com/oj/problem1432.html 深搜算法(dfs) #include <iostream> using namespace std; int m,n; int a[10][10]; int vis[10][10]; int sum,ans=100; int dx[4]={0,0,1,-1}; int dy[4]={1,...原创 2019-02-26 12:37:14 · 117 阅读 · 0 评论 -
蛇形矩阵
原题链接:http://www.dotcpp.com/oj/problem1097.html 从题目可以看出来输出就是在一条对角线上输出1,2,3...等等 由此可以发现规律,这条线上从一开始i(看做横坐标)都是大于j(看做纵坐标)的, 并且i!=1,最后递减到i=1,不过需要注意的是第一个数不是这样的,所以我在循环外就进行了赋值。 当i=1的时候,需要重新从j=1开始,所以此时,将i=j...原创 2019-02-26 12:35:16 · 110 阅读 · 0 评论 -
HH的项链
原题链接:https://ac.nowcoder.com/acm/problem/20325 莫队算法代码: #include <iostream> #include <string.h> #include <algorithm> #include <math.h> using namespace std; struct st { in...原创 2019-08-25 09:35:13 · 336 阅读 · 0 评论