POJ 1157 LITTLE SHOP OF FLOWERS

How to Hack Like a Pornstar_2017.pdf.zip How to Hack Like a Pornstar,一本17年流传于国外论坛的介绍渗透测试的书籍,不要被书名迷惑 立即下载

LITTLE SHOP OF FLOWERS
Time Limit: 1000MS Memory Limit: 10000K
Total Submissions: 10554 Accepted: 4890

Description

You want to arrange the window of your flower shop in a most pleasant way. You have F bunches of flowers, each being of a different kind, and at least as many vases ordered in a row. The vases are glued onto the shelf and are numbered consecutively 1 through V, where V is the number of vases, from left to right so that the vase 1 is the leftmost, and the vase V is the rightmost vase. The bunches are moveable and are uniquely identified by integers between 1 and F. These id-numbers have a significance: They determine the required order of appearance of the flower bunches in the row of vases so that the bunch i must be in a vase to the left of the vase containing bunch j whenever i < j. Suppose, for example, you have bunch of azaleas (id-number=1), a bunch of begonias (id-number=2) and a bunch of carnations (id-number=3). Now, all the bunches must be put into the vases keeping their id-numbers in order. The bunch of azaleas must be in a vase to the left of begonias, and the bunch of begonias must be in a vase to the left of carnations. If there are more vases than bunches of flowers then the excess will be left empty. A vase can hold only one bunch of flowers. 

Each vase has a distinct characteristic (just like flowers do). Hence, putting a bunch of flowers in a vase results in a certain aesthetic value, expressed by an integer. The aesthetic values are presented in a table as shown below. Leaving a vase empty has an aesthetic value of 0. 
 

V A S E S

1

2

3

4

5

Bunches

1 (azaleas)

723-5-2416

2 (begonias)

521-41023

3 (carnations)

-21

5-4-2020

According to the table, azaleas, for example, would look great in vase 2, but they would look awful in vase 4. 

To achieve the most pleasant effect you have to maximize the sum of aesthetic values for the arrangement while keeping the required ordering of the flowers. If more than one arrangement has the maximal sum value, any one of them will be acceptable. You have to produce exactly one arrangement. 

Input

  • The first line contains two numbers: F, V.
  • The following F lines: Each of these lines contains V integers, so that Aij is given as the jth number on the (i+1)st line of the input file.


  • 1 <= F <= 100 where F is the number of the bunches of flowers. The bunches are numbered 1 through F. 
  • F <= V <= 100 where V is the number of vases. 
  • -50 <= Aij <= 50 where Aij is the aesthetic value obtained by putting the flower bunch i into the vase j.

Output

The first line will contain the sum of aesthetic values for your arrangement.

Sample Input

3 5
7 23 -5 -24 16
5 21 -4 10 23
-21 5 -4 -20 20

Sample Output

53

Source

/*

http://acm.pku.edu.cn/JudgeOnline/problem?id=1157
DP
设f(c1, len1)表示1-c1列中,长度为len1的满足题目要求的最大值
则f(c1, len1) = maxv(f(c1 - 1, len1), f(c1 - 1, len1 -1) + input[len1][c1])
所求即为f(col, row)
虽然看上去这个DP比较简单,但却不是很容易一下子想到的
*/

#include <iostream>
#define MAX_N 100
#define maxv(a, b) ((a) >= (b) ? (a) : (b))
using namespace std;

int input[MAX_N + 1][MAX_N + 1];
int maxVal[MAX_N + 1][MAX_N + 1];
int maxCol1[MAX_N + 1];
int row, col;


void getRes()
{
    int len, c1;
   
    for(c1 = 0; c1 <= col; c1++)
        maxVal[0][c1] = maxVal[c1][0] = 0;
    for(len = 1; len <= row; len++)
    {
        for(c1 = len; c1 <= col; c1++)
        {
            if(c1 - 1 >= len)
                maxVal[c1][len] = maxVal[c1 - 1][len];
            maxVal[c1][len] = maxv(maxVal[c1 - 1][len - 1] + input[len][c1], maxVal[c1][len]);
        }
    }
   
}
int main()
{
    int i, j;
    scanf("%d%d", &row, &col);
    for(i = 1; i <= row; i++)
    {
        for(j = 1; j <= col; j++)
        {
            maxVal[i][j] = INT_MIN;
            scanf("%d", &input[i][j]);
        }
    }
    getRes();
    printf("%d/n", maxVal[col][row]);
    return 0;
}

数学史学习资料:史前数学 著名物理学家伽莫夫(宇宙大爆炸理论以及核聚变理论的提出者)在他的科普书《从1到无穷大》中举了这样一个例子。两个原始部落的酋长比赛,看谁说的数字大。第一个酋长说了三,第二个酋长想了半天,然后说你赢了。你今天听起来觉得这两个人真可笑,至少说出四,岂不就赢了?但是对这两位酋长来讲,所拥有的东西就很少超过三个,比三个多的东西他们就觉得没有必要数清楚了,就用许多来形容了。也就是说,他们生活的环境限制了他们的认知。 阅读详情

相关推荐

读《认知科学导论》(萨伽德) 总结

1. 作者的写作思路 本书是建立在对心智的理解采用表征与计算的方式。对心智表征-计算的理解方式是与计算机的本质相联系。计算机本质上是一个符号系统,符号系统包含两个部分,一个是符号,另一个是建立在符号上的操作。对心智采用表征-计算的方式理解,很容易与计算机建立起类比关系。同时人们在探索人工智能领域采用表征-计算方式已经取得了无数辉煌的成就,故表征-计算式现在研究的主流方法。 本书的有两个部分组成

xiaoqiangXX的专栏 3450

POJ - 1716 Integer Intervals

Integer Intervals Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 14913   Accepted: 6310 Description An integer interval [a,b], a Write a program that: fin

哇-WA 的博客 6440

CASS3D实战:高效三维房屋与地形采集绘制技巧

本文详细介绍了CASS3D在三维房屋与地形采集绘制中的高效技巧,包括智能绘房功能、不规则结构处理、特殊构件快速绘制及地形数据采集策略。通过实战案例和进阶操作指南,帮助用户快速掌握CASS3D的核心功能,提升三维采集与绘制效率。

weixin_29216049的博客 868

20-1-14-Prime-POJ1789

占坑 POJ1789, 2020.1.14日题, 2020.1.15日更新

shen253135371的博客 9460

NVIDIA显卡在Linux下的功率限制问题:RTX 3060 Laptop的解决方案与避坑指南

本文针对NVIDIA RTX 3060 Laptop显卡在Linux系统下遭遇功率限制的问题,提供了详细的诊断与解决方案。通过使用nvidia-smi工具监控显卡状态,并重点介绍了通过升级驱动、启用nvidia-powerd服务来激活Dynamic Boost 2.0功能,从而安全、智能地解锁额外显卡功率,有效提升性能。

weixin_29290947的博客 636

量化实战:用三种波动率模型给你的期货策略做个“体检”(附Python代码与螺纹钢案例)

本文深入探讨了三种专业波动率模型(Parkinson、Garman-Klass和Rogers-Satchell)在期货量化策略中的应用,并以螺纹钢期货为例,展示了如何通过Python实现这些模型进行多维度波动率分析。文章详细比较了不同模型的特点和适用场景,提供了动态仓位管理、止损策略优化等实战应用方案,帮助交易者更精准地评估市场风险,优化策略表现。

weixin_26824299的博客 460

【PAT B1019/A1069】 The Black Hole of Numbers

For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decreasing order, a new number can be obtained by taking the second number from the first one. Repeat in this m

zxc0074869的博客 1万+

从一只龙虾到一支团队:OpenClaw 单 Bot 多 Agent 配置实践

单 Bot 多 Agent只有一个对外的聊天入口(飞书 Bot)内部有多个独立的 AI Agent,各司其职主 Agent(总指挥)负责接收任务并分配给子 Agent子 Agent 完成任务后将结果返回给主 Agent角色Agent ID职责使用场景🎯 总指挥main-agent统筹协调,任务分发接收所有用户请求✍️ 笔杆子内容创作公众号、博客、小红书🔬 参谋canmou深度研究竞品分析、市场调研📋 运营官operations运营管理邮件、日历、社交媒体。

Maynor的博客 1082

poj1789--prim

每天进步一点点~ 今天写的是poj1789 题目的大致意思是: 给很多个长度为7的字符串,判断字符串的最小衍生数 使用的是prime算法 #define LOCAL #include &lt;stdio.h&gt; #include &lt;string.h&gt; #define MAXN 2000 + 10 #define MAXL 7+10 char truckTypes...

kanwoerzi 209

闲鱼爬虫实战:模拟手机端破解反爬策略,爬取指定商品搜索数据,爬取闲鱼搜索指定商品(需手机端模拟)o 技术点:抓包分析、cookie与token

技术点作用抓取手机 App 请求,分析 API 结构、Header、参数加密情况requestsPython 中最常用的 HTTP 库,用于发送模拟请求Session 对象自动管理 Cookie,保持会话User-Agent & 设备特征模拟手机型号、系统版本,绕过服务端检测闲鱼部分接口存在签名,需要逆向或复用有效 Token多线程/异步提高爬取效率(需节制,避免封 IP)解析 HTML 或 JSON 数据注意:闲鱼的接口加密程度中等偏上,部分接口存在动态签名(如x-signx-mini-wua。

2201_76125261的博客 712

置顶必读(3) |《滚雪球学SpringBoot》· 高质量专栏介绍,你值得拥有!

《滚雪球学SpringBoot》 并不是普通的技术讲解合集,它是专为开发者精心设计的系统化学习路径。通过不断“滚动学习”,我们将带领你从基础入门到高阶应用,从理解每一行代码到设计和优化大规模分布式系统,最终帮助你成长为一位精通 spring架构 的工程师。

**My Coding Family** 15万+

POJ 1157 LITTLE SHOP OF FLOWERS【基础DP】

题意:给出f朵花,v个花瓶,要把花都插到花瓶里去,而且花的顺序不能改变,编号小的在左边,每朵花放到花瓶里都会有一定的价值,问如何放才能产生最大的价值 我们设dp[i][j]表示处理到第i朵花,然后把第i朵花放到第j个花瓶里时所能获得的最大价值; 显然 dp[i][j] = max(dp[i - 1][k]) + val[i][j],其中k< j val[i][j]表示把第i朵花放到第j个花瓶里产生的价值 本题dp状态:

AC_Dreameng 1040

借助ChatGPT完成课题申报书中框架思路写作指南

通过这篇文章的学习,我们可以让ChatGPT先为用户匹配研究理论、研究方法、研究思路、研究内容等,为申请人提供一些参考,能够帮助对拟申报课题有一个初步的认识。当申请人找到了合适的理论、方法和问题后,再借助精细化提示词模型提问,那ChatGPT回答的启发性肯定会有质的提升,更具有使用价值。

智能AI让学术科研更容易 2468

POJ1157——LITTLE SHOP OF FLOWERS

LITTLE SHOP OF FLOWERS Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 18481   Accepted: 8512 Description You want to arrange the window of your flower shop in

Alex 1794

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

poj_1157LITTLE SHOP OF FLOWERS

题目: LITTLE SHOP OF FLOWERS Time Limit:1000MS Memory Limit:10000K Total Submissions:15079 ...

chouchijiao8952的博客 214

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

poj 1157 LITTLE SHOP OF FLOWERS

Description You want to arrange the window of your flower shop in a most pleasant way. You have F bunches of flowers, each being of a different kind, and at least as many vases ordered in a row. Th

zyq_19960204的博客 290

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

POJ1157LITTLE SHOP OF FLOWERS【dp】

Language: Default LITTLE SHOP OF FLOWERS Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 19642   Accepted: 9057 Description You want to arrange the windo

走一步再走一步 914

POJ 1157-LITTLE SHOP OF FLOWERS

POJ 1157-LITTLE SHOP OF FLOWERS

Yuric的专栏 549

poj1157LITTLE SHOP OF FLOWERS

Description You want to arrange the window of your flower shop in a most pleasant way. You have F bunches of flowers, each being of a different kind, and at least as many vases ordered in a row. Th

5年Java后端研发,分享个人读书学习笔记。 441

POJ 1157LITTLE SHOP OF FLOWERS【DP】

Description You want to arrange the window of your flower shop in a most pleasant way. You have F bunches of flowers, each being of a different kind, and at least as many vases ordered in a row....

dianxuanzhi1019的博客 147

POJ-1157-LITTLE SHOP OF FLOWERS

题目来源:http://poj.org/problem?id=1157 题目内容:LITTLE SHOP OF FLOWERS Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 21994 Accepted: 10166 DescriptionYou want to arrange the windo

m0_37685982的博客 193

POJ 1157 Little Shop Of Flowers

POJ 1157 Little Shop Of Flowers 算法分析:这是一道非常经典的动态规划问题,设当前输入的Matrix[i][j](1http://poj.org/showmessage?message_id=126272和http://blog.youkuaiyun.com/alex890714/article/details/5602512 算法实现:没啥难的,除了我开始不

BlackLillian的专栏 513
上一篇: POJ 1631 Bridging signals
下一篇: POJ 1192 最优连通子集
bobten2008
博客等级 码龄18年 153粉丝 157原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值