摘要: ```//f[i]表示从前i头牛中选,且合法,的所有方案,价值最大//第i头选或不选都可以//不选:变成f[i-1]//选i:需要知道从i开始往前连续选了多少个,最多是k//如果是x个,那么就加上w[i-x+1]+w[i-x+2]...+w[i],也就是s[i]-s[i-j]//那么再往前选的话,下标需要#include #include using namespace std;typedef l... 阅读全文
posted @ 2020-05-02 21:53 晴屿 阅读(132) 评论(0) 推荐(0) 编辑
摘要: ``` #include #include #include using namespace std; const int N = 500; int f[N][N]; int h[N], e[N], ne[N], idx; int n, p; int ans = 0x3f3f3f3f; int in[N]; void add(int a, int b) { e[idx] = b; ne[idx] 阅读全文
posted @ 2020-05-02 21:43 晴屿 阅读(110) 评论(0) 推荐(0) 编辑
摘要: ``` #include #include #include #include using namespace std; const int N = 505; int n, k; int a[N], b[N]; bool f[N][N]; int main() { scanf("%d%d", &n, &k); long long sum_a = 0, sum_b = 0; for(int i = 阅读全文
posted @ 2020-05-02 16:48 晴屿 阅读(269) 评论(0) 推荐(1) 编辑
摘要: ``` #include using namespace std; typedef long long ll; const ll mod = 1e9 + 7; const int N = 5010; char str1[N], str2[N]; int p[N], a[N], mod2; ll dp[N][65][65]; ll dfs(int pos, int sum, int last, bo 阅读全文
posted @ 2020-05-02 15:23 晴屿 阅读(293) 评论(0) 推荐(0) 编辑