当前位置: 首页 > news >正文

优秀网站设计参考wordpress 大气模板下载

优秀网站设计参考,wordpress 大气模板下载,怎样在安装wordpress,免费的软件网站建设题意#xff1a; 给你两个数字n和m#xff1b;代表会有n个苹果掉落#xff0c;m次可以移动的机会#xff1b;有两棵树#xff0c;开始你站在树1下面#xff0c;一分钟只能移动一次#xff0c;下面的数值代表在哪一颗树下会掉落苹果#xff1b;问你在可移动的范围内 给你两个数字n和m代表会有n个苹果掉落m次可以移动的机会有两棵树开始你站在树1下面一分钟只能移动一次下面的数值代表在哪一颗树下会掉落苹果问你在可移动的范围内最多可以接到多少个苹果 题目 It is a little known fact that cows love apples. Farmer John has two apple trees (which are conveniently numbered 1 and 2) in his field, each full of apples. Bessie cannot reach the apples when they are on the tree, so she must wait for them to fall. However, she must catch them in the air since the apples bruise when they hit the ground (and no one wants to eat bruised apples). Bessie is a quick eater, so an apple she does catch is eaten in just a few seconds. Each minute, one of the two apple trees drops an apple. Bessie, having much practice, can catch an apple if she is standing under a tree from which one falls. While Bessie can walk between the two trees quickly (in much less than a minute), she can stand under only one tree at any time. Moreover, cows do not get a lot of exercise, so she is not willing to walk back and forth between the trees endlessly (and thus misses some apples). Apples fall (one each minute) for T (1 T 1,000) minutes. Bessie is willing to walk back and forth at most W (1 W 30) times. Given which tree will drop an apple each minute, determine the maximum number of apples which Bessie can catch. Bessie starts at tree 1. Input Line 1: Two space separated integers: T and W Lines 2…T1: 1 or 2: the tree that will drop an apple each minute. Output Line 1: The maximum number of apples Bessie can catch without walking more than W times. Sample Input 7 2 2 1 1 2 2 1 1 Sample Output 6 Hint INPUT DETAILS: Seven apples fall - one from tree 2, then two in a row from tree 1, then two in a row from tree 2, then two in a row from tree 1. Bessie is willing to walk from one tree to the other twice. OUTPUT DETAILS: Bessie can catch six apples by staying under tree 1 until the first two have dropped, then moving to tree 2 for the next two, then returning back to tree 1 for the final two. 分析 (1.基础dp题,按照题意很容易看出有两个变量分钟和移动机会所以我们按照习惯写出两层for循环简单思考其中的关系就可以得到dp定义,dp[i][j]dp[i][j]dp[i][j],表示在i时间内,用 jjj次转移机会得到的最大苹果数. (2).因为开始的位置在第一棵树下那么我们就可以由移动的步数 jjj的奇偶性判断现在在哪颗树下 (3).dp转移如下,如果 j0j0j0,则 dp[i][j]dp[i−1][j]dp[i][j]dp[i-1][j]dp[i][j]dp[i−1][j],考虑j为0时到第i分钟一步都没有走动。 否则 dp[i][j]max(dp[i−1][j],dp[i−1][j−1])dp[i][j]max(dp[i-1][j],dp[i-1][j-1])dp[i][j]max(dp[i−1][j],dp[i−1][j−1]).就是当前从上一个状态下走还是不走获得苹果最多。 (4)如果现在所在的树的编号和现在掉落的苹果所在的位置相同那么接到的苹果的数量姐增加由2这个我就放在最后判断一下就行也可以放在第三步直接在推导式里面。 (5).最后在 dp[n][i]dp[n][i]dp[n][i]里找最大值就行了,(0in).(0in).(0in).表示一共走i步时n分钟吃到苹果最大值。 我今天真的闲的罗里吧嗦这么多自恋的觉得只要跟着我的思路走一定能会这道题hhh AC模板 #includestdio.h #includestring.h #includealgorithm using namespace std; const int M1e310; int n,m,ans; int s[M],dp[M][35]; int main() {while(~scanf(%d%d,n,m)){ans0;memset(dp,0,sizeof(dp));for(int i1; in; i)scanf(%d,s[i]);if(s[1]1)dp[1][0]1;elsedp[1][1]1;for(int i2; in; i)for(int j0; jijm; j){if(j0)//考虑j为0时也就是说到第i分钟一步都没有走动。dp[i][j]dp[i-1][j]s[i]%2;else{dp[i][j]max(dp[i-1][j],dp[i-1][j-1]);//就是当前走还是不走获得苹果最多。if(j%21s[i])//因为最开始站在树1下面可以用走多少步的奇偶来表示当前在那棵树下。dp[i][j];}}for(int i0; im; i)//表示一共走i步时n分钟吃到苹果最大值。ansmax(ans,dp[n][i]);printf(%d\n,ans);}return 0; } 备战ccpc分站赛ing 题目分析简略见谅转载请注明出处。。。。。
http://www.huolong8.cn/news/36327/

相关文章:

  • 做公众号首图的设计网站mip网站有什么好处
  • 网站建设个人学网站开发怎么就业
  • 做电商网站都需要学什么条件销售怎样找精准客户
  • 九江做网站公司怀化订水网站
  • 网站开发使用数据库的好处wordpress 外链视频
  • 织梦网站如何做地区分站php在网站开发中的作用
  • 大多数网站开发现状wordpress输网址采集
  • 南浦电商网站建设自媒体123网站
  • 北京 好的网站制作注册公司
  • 做网络销售都做什么网站网站服务器基本配置
  • 建一个企业网站多少钱阿里巴巴网站服务器成本
  • 实训做网站收获安徽建设部网站
  • 免费网站大全做企业网站有前途吗
  • 个人域名可以建公司网站吗域名的定义
  • 企业网站网站建设价格php企业网站整站源码
  • 江西网站建设推广自己做儿童衣服教程的网站
  • 做服饰的有哪些网站wordpress的根目录
  • 西安网站网络营销wordpress添加页面的代码
  • 在建设厅网站上下载资质标准建设网站比较好的公司吗
  • 制作网站域名需要多少钱在哪个网站做劳动用工备案
  • 建设通同类网站电影网站如何优化
  • wordpress突然访问不了导航网站怎么做seo
  • 云一网站公司淘宝关键词优化推广排名
  • 动易网站迁移分销商城系统要具备哪些
  • 私人网站建设方案书框架栏目赤峰市建设网站
  • 模板网站和定制网站后缀的区别wordpress对接api
  • 一个网站后台怎么做在线房产网
  • 产品经理做网站网页制作教程菜鸟
  • 手机网站关键词排名网上花店网站建设规划书
  • 西安专业网站建设价格高防手表网站