FatMouse's Speed---hdu1160(简单dp)】的更多相关文章

/* 简单dp,要记录顺序 解:先排序,然后是一个最长下降子序列 ,中间需记录顺序 dp[i]=Max(dp[i],dp[j]+1); */ #include<stdio.h> #include<string.h> #include<stdlib.h> #define N 1100 /*w,s代表重量和速度,index记录原来输入时的顺序下标,pre指向排序后的上一个下标,answer记录排序后每一个位置的最优值*/ typedef struct node { int…
FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as large a subset of this data as possible into a sequence so that the weights are increasing, but the speed…
传送门: ZOJ:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=108 HDU :http://acm.hdu.edu.cn/showproblem.php?pid=1160 题目大意: 输入好多组w 和 s 代表老鼠的重量和速度,要求找出满足 w 严格 升序, s严格降序的最大长度和他们的序号. 我是先排序,然后和ZOJ 1136 Longest Ordered Subsequence (http://blog.csdn.…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1160 题意就是给你一些老鼠(编号1,2,3,4,5,6,7,8...)的体重和他们的速度然后求出最大的n满足 W[m[1]] < W[m[2]] < ... < W[m[n]] and S[m[1]] > S[m[2]] > ... > S[m[n]] 然后把原来的编号按照上面的序列输出来: 先把他们排序一下dp的时候记录一下路径: #include<stdio.h&…
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1160 FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17386    Accepted Submission(s): 7694Special Judge Problem Description…
FatMouse's Speed Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1160 Description FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on…
FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 13643    Accepted Submission(s): 6011Special Judge Problem Description FatMouse believes that the fatter a mouse is, the faster i…
FatMouse's Speed Time Limit: 2 Seconds      Memory Limit:65536 KB     Special Judge FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as large a subset of thi…
FatMouse's Speed Time Limit: 2 Seconds      Memory Limit:65536 KB     Special Judge FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as large a subset of thi…
J - FatMouse's Speed DP的题写得多了慢慢也有了思路,虽然也还只是很简单的DP. 因为需要输出所有选择的老鼠,所以刚开始的时候想利用状态压缩来储存所选择的老鼠,后面才发现n太大1<<1000根本存不下来... 思路的话其实也不难,把体重排序之后,对速度求一个最长下降子序列即可. 对于每一次求最长有序子序列,只需要全部遍历一遍,遍历的时候,将该位置作为所选择序列的最后一个元素,DP[i]即为该序列的最大长度. 代码: // Created by CAD on 2019/10/…