摘要: 这道题运用DP的解法,大致思路是我为人人。 定义状态 f[i][0] 表示为前i个格子,最终大写锁定为小写的最小值。 f[i][1] 表示为前i个格子,最终大写锁定为大写的最小值。 推导转移式 当a[i]为小写时 f[i][0]=min(f[i-1][0]+1,f[i-1][1]+2); f[i][ 阅读全文
posted @ 2020-04-21 21:38 nhflsoiers 阅读(140) 评论(1) 推荐(0)
摘要: 这个题的主要思路是DP 其实整体的思路——我为人人 设立f[i][j],即为从起点到第i行第j列位置的方案数 那么我们需要考虑: 当已经走到了i,j这个点,那么我将用这个格子的能量(num[i][j])。 因为方向是只能向右向下(不限定方向你还能求?),所以我们需要枚举新的点x,y。 这个点x,y是 阅读全文
posted @ 2020-04-20 22:07 nhflsoiers 阅读(162) 评论(0) 推荐(0)
摘要: 带注释的代码,客官享用~~~ #include<iostream>#include<cstring> #include<cstdio> #include<algorithm> using namespace std; int dp[100009][20]; int main() { int n; i 阅读全文
posted @ 2020-04-20 15:40 nhflsoiers 阅读(93) 评论(0) 推荐(0)
摘要: 前二十个Humble Numbers:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27…… 用c2,c3,c5,c7做指针,a[i]= min(a[c2]*2,a[c3]*3,a[c5]*5,a[c7]*7) 阅读全文
posted @ 2020-04-20 13:37 nhflsoiers 阅读(226) 评论(0) 推荐(0)
摘要: #include<iostream> #include<algorithm> #include<string> #include<cstring> #include<queue> using namespace std; int dx[]={0,0,1,-1}; int dy[]={1,-1,0,0 阅读全文
posted @ 2020-03-29 11:45 nhflsoiers 阅读(629) 评论(0) 推荐(1)
摘要: #include <iostream>#include <cstring>#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <time.h>#include <string>#include 阅读全文
posted @ 2020-03-28 00:03 nhflsoiers 阅读(128) 评论(0) 推荐(0)
摘要: 我又来写题解了~~~ #include<cstdio>#include<cstring>#include<queue>using namespace std;const int maxn=305;bool mp[maxn][maxn]; int sx,sy,tx,ty,l; int tox[]={1 阅读全文
posted @ 2020-03-27 22:47 nhflsoiers 阅读(161) 评论(0) 推荐(0)
摘要: 上次写完IDA*+曼哈顿,这次来一个双向BFS+map(别问我怎么那么多做法) #include<bits/stdc++.h>using namespace std;typedef long long ll;inline ll read() { ll f=1,x=0; char ch; do { c 阅读全文
posted @ 2020-03-27 20:57 nhflsoiers 阅读(114) 评论(0) 推荐(0)
摘要: 我又来写题解了~~~ 我的方法:IDA*+曼哈顿 代码奉上,客官慢慢享用~ #include<bits/stdc++.h>using namespace std;string st,ed;int depth;int hfunc(string st){ int ans=0; for (register 阅读全文
posted @ 2020-03-27 15:32 nhflsoiers 阅读(102) 评论(2) 推荐(0)
摘要: 想当年,全部人都在评论区里刷我的名字~ ε=(´ο`*)))唉泪,奔涌 不过为了帮助广大群众,我还是选择写了这份题解…… 题目不想说了…… 代码如下: #include<bits/stdc++.h>#define P pair<LL,LL>#define f(x) x.first#define s( 阅读全文
posted @ 2020-03-27 14:08 nhflsoiers 阅读(196) 评论(0) 推荐(0)