FatMouse's Speed 【HDU - 1160】

扫地机器人解决方案:工作原理与硬件构成 房间里柜子,鞋子,床,座椅,人都在什么地方?3、数字信号处理器。这主要是为控制芯片进行路径规划后,下发指令给执行的电机,包括舵轮(扫地机人前进,转向的轮子),扫地刷的电机,吸尘器的电机,让这些电机工作。扫地机器人的大脑主要用来规划路径,避障,以及人机交互,例如:人类设定打扫范围,以及语音指导扫地机器人进行打扫,都需要处理器进行处理后,将指令下发到执行机构。小脑属于跟执行层最近的控制区域,例如我们上面说的,后面两个处理器:数字信号处理器和微控制器都是对执行层(电机),进行控制和回馈外部信息的处理器。 阅读详情

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 speeds are decreasing.

Input

Input contains data for a bunch of mice, one mouse per line, terminated by end of file.

The data for a particular mouse will consist of a pair of integers: the first representing its size in grams and the second representing its speed in centimeters per second. Both integers are between 1 and 10000. The data in each test case will contain information for at most 1000 mice.

Two mice may have the same weight, the same speed, or even the same weight and speed.

Output

Your program should output a sequence of lines of data; the first line should contain a number n; the remaining n lines should each contain a single positive integer (each one representing a mouse). If these n integers are m[1], m[2],..., m[n] then it must be the case that

W[m[1]] < W[m[2]] < ... < W[m[n]]

and

S[m[1]] > S[m[2]] > ... > S[m[n]]

In order for the answer to be correct, n should be as large as possible.
All inequalities are strict: weights must be strictly increasing, and speeds must be strictly decreasing. There may be many correct outputs for a given input, your program only needs to find one.

Sample Input

6008 1300
6000 2100
500 2000
1000 4000
1100 3000
6000 2000
8000 1400
6000 1200
2000 1900

Sample Output

4
4
5
9
7

题意:

第一列是第几个老鼠的重量,第二列是第 几 个老鼠的速度,求满足第一个升序,第二个数组降序的最多老鼠数量。

这是一道典型的DP题,根据题意不难看出此题需要用到结构体。

代码:

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int dp[1010];

struct node
{
    int a,b,c;
} qw[1010];

bool cmp(node xx,node yy)
{
    if(xx.b==yy.b)
        return xx.a<yy.a;
    else
        return xx.b>yy.b;
}

struct note
{
    int x,y;
} s[1010];

int main()
{
    int k=0;
    memset(dp,0,sizeof(dp));
    while(~scanf("%d%d",&qw[k].a,&qw[k].b))
        qw[k].c=k+1,k++;
    int maxx=0;
    sort(qw,qw+k,cmp);//对速度降序排序

    for(int i=0; i<k; i++) //找重量的最长上升子序列
    {
        dp[i]=1;

        for(int j=0; j<i; j++)
            if(qw[i].a>qw[j].a)
                dp[i]=max(dp[i],dp[j]+1);

        if(maxx<dp[i])  //最长长度
            maxx=dp[i];

        s[i].x=0; 
    }
    s[maxx+1].x=0x3f3f3f3f;
    printf("%d\n",maxx);

    for(int i=k-1; i>=0; i--)
        if(qw[i].a<s[dp[i]+1].x)  //如果这个长度的重量小于下一个长度下的重量,才能满足题意
            if(qw[i].a>s[dp[i]].x)  //更新最大值,且保存老鼠的位置
            {
                s[dp[i]].x=qw[i].a;
                s[dp[i]].y=qw[i].c;
            }

    for(int i=1; i<=maxx; i++)
        printf("%d\n",s[i].y);
           return 0;
}

 

用 SAP ABAP ALV 重塑 SM30:可扩展的自定义表维护视图与自动传输实践 文章摘要: 本文提出了一种基于ALV Grid的动态表维护框架,用于替代传统SM30维护视图。该方案通过输入表名自动生成维护界面,支持动态筛选、批量操作和自动传输管理。核心设计包括:利用BAdI实现扩展点、通过行状态字段简化数据变更跟踪、使用Style Table控制单元格编辑权限、集成CTS实现自动传输。相比SM30标准维护,该框架显著提升了交互体验(支持ALV排序/过滤/汇总)和业务扩展性(统一校验与权限控制),同时解决了"维护+传输"流程割裂的问题。文中详细阐述了技术实现方案,并提 阅读详情

相关推荐

逆向实战:TikTok X-Gorgon算法解析与Unidg补环境技巧

本文详细解析了TikTok X-Gorgon算法的逆向工程全流程,包括参数定位、变种RC4算法还原及Unidbg补环境技巧。通过动态调试与静态分析相结合,揭示了X-Gorgon的生成逻辑和加密细节,为移动安全研究提供了实用指南。

weixin_28568819的博客 694

FatMouse believes that the fatter a mouse is, the faster it runs.

这题用DP 处理最长子序列 然后在输出他的标号。  #include&lt;iostream&gt;//动态规划 #include&lt;cstdio&gt; #include&lt;cstring&gt; #include&lt;string&gt; #include&lt;algorithm&gt; const int MAX = 10010;//题目中给了最多1000只老鼠但是没说给几组...

weixin_43898670的博客 1164

01 Aras Innovator二次开发实战:从IOM到AML的完整交互指南

本文详细介绍了Aras Innovator二次开发实战,从IOM到AML的完整交互指南。通过JavaScript和C#代码示例,展示了如何在客户端和服务端使用IOM进行开发,并深入解析AML语言的基础语法和调试技巧。文章还提供了文档管理和BOM管理等典型场景的实战案例,帮助开发者快速掌握Aras Innovator二次开发的核心技术。

wind6的博客 651

FatMouse's Speed

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 sequenc...

li_wen_zhuo的博客 527

Qt for Android:基于libusb实现CH340x串口通信的高效开发方案

本文详细介绍了在Qt for Android环境下,基于libusb实现CH340x串口通信的高效开发方案。通过绕过Android高版本系统的权限限制,利用libusb+JNI技术实现稳定通信,适用于工业手持终端等场景。文章涵盖环境搭建、核心实现、常见问题解决方案及性能调优经验,帮助开发者快速掌握这一关键技术。

weixin_42715608的博客 427

基于gem5模拟trace的cache模拟器的实现

在做计算机体系结构的时候,模拟器是一个重要且又有效的工具。其中gem5集成了gem和m5的优点,使用起来比较简单和方便。其中包括了se模式和fs模式,se模式是在gem5运行我们已经编译好的程序,可以获取cache,cpu状态等数据,fs模式下可以模拟操作系统,我们可以将我们自己修改的linux内核加载到哥们上运行。下面介绍了使用gem5的se模式,运行编译好的ARM可执行文件。获取访存的trac

gaoxiang的专栏 8891

hdu 1160 FatMouse's Speed (LIS)

FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8187 Accepted Submission(s): 3645 Special Judge Problem Description FatMouse believes that the fatter a mouse is, the faster it ru

Coding A World 875

Java对接快递鸟,查询快递物流信息

根据用户输入的订单号,我们的后台识别订单号并根据快递鸟查询快递API接口,实现自动查询的功能。下面是java版本的根据单号查询物流跟踪信息的详细示例代码。只需要下载就可以运行,(自己需要简单的修改)注:登录快递鸟用户管理后台后获得。登录快递鸟用户管理后台。

Roc的博客 958

FatMouse's Speed (最长上升子序列+记录路径)

FatMouse’s Speed (最长上升子序列+记录路径) 问题描述: 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...

菜鸡的博客 575

黑猫带你学eMMC协议第1篇:全网最全emmc协议中文详讲,这份学习框架图,你值得拥有!!!(持续更新中...)

黑猫带你学eMMC协议第7篇:全网最全emmc写保护详解(write protect) 黑猫带你学eMMC协议第8篇:emmc可靠写详解(Write Reliability) 黑猫带你学eMMC协议第9篇:emmc的分区配置(partitioning) 黑猫带你学eMMC协议第10篇:eMMC命令队列详解(CMDQ) 黑猫带你学eMMC协议第11篇:eMMC擦除详解(erase/trim/discard/sanitize/secure erase/secure trim…) 黑猫带你学eMMC协议第12篇:

黑猫奥利奥的博客 2万+

【总目录】AUTOSAR精进之路专栏介绍及内容目录持续更新...

本专栏系统讲解AUTOSAR汽车电子开发技术,包含Eth/OS/Can/Lin等协议栈、MCAL驱动、功能安全等核心模块。内容基于实际项目经验,从概念原理到工程配置、特殊需求实现及问题排查进行深入剖析。重点涵盖TC3xx芯片平台开发、多核OS、网络管理、存储协议栈等难点问题,提供100+篇原创技术文章。专栏采用付费模式,保证内容完整性和持续更新,并提供专业答疑服务。适合汽车电子工程师系统学习AUTOSAR开发技术。

qq_36056498的博客 6511

HDU-1160 FatMouse's Speed

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...

XYBDX的博客 293

视频理解与处理——OpenClaw视频能力深度解析(2026视频版)

本文介绍了OpenClaw视频理解与处理的核心技术,重点分析了视频预处理流程。通过VideoProcessor类实现视频加载、帧采样、尺寸调整和归一化等基础处理功能,支持本地和在线视频源处理,为后续视频分析任务提供标准化输入。预处理模块采用均匀采样和标准化方法优化视频数据,确保动作识别、场景分析等高级应用的准确性,展现了OpenClaw强大的视频处理能力。

一键难忘的博客 464

FatMouse's Speed HDU - 1160

FatMouse’s Speed HDU - 1160 题意: 胖老鼠认为越胖的老鼠跑的越快,为了证明这个,你想要通过一堆数据证明越胖越慢。 输入:一堆老鼠,一个老鼠一行,到文件结束。每行包括重量,和速度。(不超过1000只老鼠,整数不超过10000) 输出:n个老鼠的数量,n行表示编号,该编号的老鼠必须重量是递增的,速度是递减的。 思路:排序找最长上身序列。 #include&lt...

DeathYmz的博客 732

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

HDU 1160 FatMouse's Speed(dp)

Total Submission(s): 20872 Accepted Submission(s): 9269Special Judge   Problem Description FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to tak...

abns的博客 164

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

FatMouse's Speed 【HDU 1160】

题目链接 HDU 1160 题目大意 每一只老鼠有两个参数,在n只老鼠中找出最大数量的老鼠,这些老鼠的第一个参数是递增的,第二个参数是递减的,输出这个数量并且输出这些老鼠的编号。 解题思路 其实用的就是最长上升子序列,然后主要是要保存这些老鼠的编号,我本来使用vector模拟保存的,但是吧。。。。然后一直wa,以为是我的思路不对,其实后面发现是智障的b打成了a,在网上还学到用pre数组保存前一个的...

qq_41925919的博客 238

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

HDU 1160 FatMouse's Speed

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1160 分析:结构体内用一个元素记录每个老鼠的初始编号,然后对体重进行排序,对速度dp(注意体重不相等); 结构体内再用一个元素记录初始编号为i的老鼠在最长序列中上一个是初始编号为j的老鼠 1 #include<iostream> 2 #include<s...

weixin_38170853的博客 89

HDU1160 FatMouse's Speed —— DP

题目链接: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): 17386Ac...

alince20008的博客 154

HDU 1160 FatMouse's Speed (最长上升子序列+记录路径)

题目链接:HDU 1160 FatMouse's Speed 题意:求体重越重,反而速度越慢的例子,并输出对应的编号。 对speed进行从大到小排序,再求weight的最长上升序列,并输出路径。 AC代码: #include #include #include using namespace std; struct Node { int weight; int spee

n-1 924

HDU - 1160 FatMouse's Speed

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...

Prince_NYing的博客 253

HDU1160——FatMouse's Speed

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1160 题目分析:输入一组体重和速度的数据,找到尽可能长的序列,满足体重严格递增,速度严格递减。 解题思路:先按体重升序排列,然后在排列后的数据中找到最长的递减的序列。这里由于不仅仅是要你输出序列的长度,还要输出最长的序列是由哪些数据组成。这样在DP的同时,需要记录每一个最优解得到的过程。 其实这

kay_zhyu的专栏 743

HDU 1160-FatMouse's Speed

Problem Description 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 pos...

cheerful_man的博客 316

hdu1160 FatMouse's Speed

FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7299Accepted Submission(s): 3229Special...

Phoebe_Wu2016的博客 161
上一篇: Greatest Common Increasing Subsequence【 HDU - 1423 】
下一篇: Cheapest Palindrome【 POJ - 3280 】
Daisy's一乐景三
博客等级 码龄8年 2粉丝 56原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值