练习
文章平均质量分 59
xlhzxx8127
人菜瘾大
展开
-
练习-搜索-记忆化搜索-最长食物链
记录每天的成果#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>#include<vector>using namespace std;const int M=80112002;const int maxn=5e3+5;int n,m;int u,v,ans;vector<int>G[maxn];int rd[maxn];原创 2021-09-08 23:20:43 · 122 阅读 · 0 评论 -
训练-topo的应用-最长路
题目来自洛谷图论官方题单以前一直知道有topo排序,但不知道它有什么用,直到今天。topo可以解决和前驱有关的问题,使得该步骤执行时前驱事件已经完成下面是用topo解决有向图点1到点n最长路径的问题的代码#include<cstdio>#include<cstring>#include<iostream>#include<queue>#include<algorithm>#include<vector>//使用top原创 2021-09-08 23:09:13 · 118 阅读 · 0 评论 -
8/5(后缀数组应用/板板)
题目描述Farmer John has noticed that the quality of milk given by his cows varies from day to day. On further investigation, he discovered that although he can’t predict the quality of milk from one day to the next, there are some regular patterns in the dail原创 2021-08-05 21:41:45 · 69 阅读 · 0 评论 -
线段树(练习/7/31)
DescriptionRailway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…The Lunar New Year was approaching, but unluckily the Little Cat still had schedules going here and there. Now, he had to t原创 2021-07-31 21:46:26 · 77 阅读 · 0 评论 -
2021-07-25(动态规划)
链接:https://ac.nowcoder.com/acm/problem/15553来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述今天qwb要参加一个数学考试,这套试卷一共有n道题,每道题qwb能获得的分数为ai,qwb并不打算把这些题全做完,他想选总共2k道题来做,并且期望他能获得的分数尽可能的大,他准备选2个不连续的长度为k的区间,即[L,L+1,L+2,…,L+k-1],原创 2021-07-25 15:24:25 · 76 阅读 · 0 评论 -
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 · 226 阅读 · 0 评论 -
滑雪(动态规划)
题目大意:给一个矩阵,矩阵里面的数表示相应位置的高度。滑雪只能由高处往低处滑,问一次性最多能滑过多少个点。利用动态规划首先要注意:当前问题能由子问题推出来。子问题在前面已经解决过。有一种巧妙的办法:如果我们将节点降序排序。以当前节点为尾巴,那么我们只要遍历比它更高的点,然后判断比它更高的点是不是它相邻的点,如果是,我们就要维护这个最大值:dp[i].path=max(dp[i].path,dp[j].path+1),由于i在j之后,所以一定比j点路程多1。(转移过程中用的是前缀)然后我们记录整个过程中原创 2021-07-17 15:59:08 · 547 阅读 · 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 · 69 阅读 · 1 评论 -
2021-07-15(动态规划/递归)
Brackets SequenceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 38784 Accepted: 11212 Special JudgeDescriptionLet us define a regular brackets sequence in the following way:Empty sequence is a regular sequence.If S is a regular sequenc原创 2021-07-15 14:18:39 · 51 阅读 · 0 评论 -
贪心思想(2021/7/15)
DescriptionHere is a famous story in Chinese history.That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with the king and others.Both of Tian and the king have three horses in different cl原创 2021-07-15 00:58:29 · 84 阅读 · 0 评论 -
2021-07-11
One Person GameThere 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 · 97 阅读 · 0 评论 -
2021-07-09
Pass-MurailleTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 13172 Accepted: 4178DescriptionIn 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 · 62 阅读 · 0 评论 -
2021-07-07
**The Balance** Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 11578 Accepted: 5028DescriptionMs. 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 · 65 阅读 · 0 评论 -
xlh刷书日记(BFS)
POJ 3278DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,000) on the same number line. Farmer原创 2021-04-25 19:50:52 · 89 阅读 · 2 评论