cheeserish
cheeserish
全部文章
分类
题解(62)
归档
标签
去牛客网
登录
/
注册
cheeserish的博客
TA的专栏
3篇文章
0人订阅
牛客多校练习
2篇文章
785人学习
每日打卡
1篇文章
719人学习
全部文章
(共62篇)
过河卒
比较坑的,注意数据范围,开long longdp[i][j]表示到达(i,j)点的路径数 #include<bits/stdc++.h> using namespace std; #define int long long int mp[30][30],dp[30][30]; signe...
2020-06-19
8
694
合唱队形
类似于最长上升子序列;dp[i]=max(dp[i],dp[j]+1) (a[i]>a[j]) #include<bits/stdc++.h> using namespace std; int n,t[200],dp[200],dp1[200],ans;//dp是左半段,dp1...
2020-06-19
0
627
取数游戏2
比较直接的dp,状态当前选择左端还是右端,以及i之前选了几个左端dp[ i ][ j ][ 0/1 ], 表示当前选择右端,1表示当前选择左端,j表示到达i时,已经选择j个左端。 #include<bits/stdc++.h> using namespace std; const int...
2020-06-18
0
720
古老的牛市,遗迹的天梯
dp[i]表示到达第i级台阶所需的步数;判断是否有解的时候,那个数值要大一点。 #include<bits/stdc++.h> using namespace std; #define int long long const int maxn=500; const int inf=0x3...
2020-06-18
0
807
传球游戏
根据题意描述,知道状态的转移跟次数m和n有关,初步建立二维dp读过题意之后dp[ i ][ j ]表示传了j次后到达i的方法数;因为是个圆形,对于最后一个和第一个判定一下;初始化dp[ 1 ][ 0 ]=1;根据状态转移方程,dp[ i ][ j ]=dp[ i-1 ][ j-1 ] + dp[ i...
2020-06-17
5
683
滑雪
到达(i,j)点的长度=max(周围比它大的点的数目+1);而枚举的时候,需要按照一定的顺序,这样避免遗漏; #include<iostream> #include<algorithm> #include<cstring> using namespace std;...
2020-06-15
0
779
华尔兹
这题只需要从起点走到终点,所以选择bfs; #include<bits/stdc++.h> using namespace std; int n,m,sx,sy,tx,ty; int mp[1010][1010],vis[1000010],pre[1010][1010];//pre数组存...
2020-06-14
0
599
after与迷宫
这题比较坑的是题意难理解。我是没从题目中理解出F和M同时出现才会变成机器人,QAQ。理解出来就好办了,可以用双向bfs,也可单向bfs;最后求出的路径×2; #include<bits/stdc++.h> using namespace std; int n,m,mp[1001][100...
2020-06-13
4
902
栗酱的不等式
注意开Long Long ,避免爆int;枚举n的值,判断满足条件的解的个数;r为右边界,n的最大值<=81e16,l为右边界;mid/h为y满足当前x=i时的条件个数,即为当前条件下解的个数 #include<bits/stdc++.h> using namespace std;...
2020-06-07
0
715
装备合成
老实说,看数据没什么明显提示;打表,找规律;知道函数满足三分条件; #include<iostream> #include<algorithm> #include<queue> #include<cstring> #include<map>...
2020-06-07
0
758
首页
上一页
1
2
3
4
5
6
7
下一页
末页