笔记
xlhzxx8127
人菜瘾大
展开
-
与最短路结合的区间dp-牛牛的回文串
题目传送门: https://ac.nowcoder.com/acm/problem/21337 题目大意: 通过以下三种操作,将字符串S变成回文串。如果不能实现,输出-1,否者输出最小的花费 1:在任意位置增加一个字符 2:删除一个字符 3:改变一个字符 输入: 一个字符串S、和整数M 用M条语句来描述能进行的操作 add c x 表示增加c字符需要x的代价 erase c x表示删除c字符需要x的代价 change c1 c2 x表示将c1 改成c2需要x的代价 思路:对于回文串来说,我们要各个元素匹配原创 2022-04-13 21:39:45 · 202 阅读 · 4 评论 -
2021/7/23
链接:https://ac.nowcoder.com/acm/problem/17315 来源:牛客网 Applese有1个容量为v的背包,有n个物品,每一个物品有一个价值ai,以及一个大小bi 然后他对此提出了自己的疑问,如果我不要装的物品装的价值最大,只是一定需要装m个物品,要使得求出来的物品价值的中位数最大 Applese觉得这个题依然太菜,于是他把这个问题丢给了你 当物品数量为偶数时,中位数即中间两个物品的价值的平均值 输入描述: 第一行三个数v, n, m,分别代表背包容量,物品数量以及需要取出的原创 2021-07-23 22:44:38 · 253 阅读 · 0 评论 -
2021-07-16(动态规划)
## dollars 来源UVA 147 题目大意:给定,输入一个合法的钱数(要求是五分的整数倍)输出组成这钱数组合数。 给定了0.05 0.10 0.20 0.50 1 2 5 10 20 50 100刀的货币。 思路:先想象将这些钱拆成5分的硬币,将其中一部分硬币捆绑,不同捆绑的组合就是问题的解 做法: 利用dp,用前i种货币组成j个5分钱记为dp[j]; 前i种货币面值组成j个5分钱组成种类数=前i-1种货币面值组成j个5分钱种类数+至少有一个i种类货币面值参与的组成数。 对于上...原创 2021-07-16 16:59:04 · 83 阅读 · 1 评论 -
2021-07-11
One Person Game There is an interesting and simple one person game. Suppose there is a number axis under your feet. You are at point A at first and your aim is point B. There are 6 kinds of operations you can perform in one step. That is to go left or righ原创 2021-07-11 11:21:31 · 109 阅读 · 0 评论 -
2021-07-10
There is an interesting and simple one person game. Suppose there is a number axis under your feet. You are at point A at first and your aim is point B. There are 6 kinds of operations you can perform in one step. That is to go left or right by a,band c, h原创 2021-07-10 15:29:25 · 65 阅读 · 0 评论 -
2021-07-09
Pass-Muraille Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13172 Accepted: 4178 Description In modern day magic shows, passing through walls is very popular in which a magician performer passes through several walls in a predesigned stage s原创 2021-07-09 18:45:35 · 78 阅读 · 0 评论 -
2021-07-07
**The Balance** Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 11578 Accepted: 5028 Description Ms. Iyo Kiffa-Australis has a balance and only two kinds of weights to measure a dose of medicine. For example...原创 2021-07-09 18:33:59 · 80 阅读 · 0 评论 -
2021-04-03
#include<bits/stdc++.h> using namespace std; const int N=4e2; struct node{ int l; int r; int w; int maxx; int num; }; node tree[N]; int dp[N];//记录该节点以下有几个逆序数 void build(int k,int l,int r){//先建树,待会再进行区间修改 tree[k].l=l; tree[k].r=r; if(l==r)原创 2021-04-03 21:02:41 · 79 阅读 · 1 评论 -
水一波训练赛的题目(BALANCED LINEUP)
#include<iostream> #include<string> #include<algorithm> #include<stdio.h> using namespace std; struct node{ int l; int r; int mi; int mx; }; int ansmx,ansmi; node tree[1000005]; void build(int l,int r,int k){ tree[k].l=l;tree[.原创 2021-04-02 21:23:43 · 74 阅读 · 2 评论