[leetcode]553. Optimal Division

162 篇文章 0 订阅

[leetcode]553. Optimal Division


Analysis

啊啊啊啊啊啊—— [生死有命富贵在天]

Given a list of positive integers, the adjacent integers will perform the float division. For example, [2,3,4] -> 2 / 3 / 4.
However, you can add any number of parenthesis at any position to change the priority of operations. You should find out how to add parenthesis to get the maximum result, and return the corresponding expression in string format. Your expression should NOT contain redundant parenthesis.
一开始想了很多,暴力啊,DP啊,最后发现只是个数学问题,这个博客解释的比较清楚:https://blog.csdn.net/hiroshiten/article/details/72758435

Implement

class Solution {
public:
    string optimalDivision(vector<int>& nums) {
        int len = nums.size();
        string res = "";
        for(int i=0; i<len; i++){
            if(i > 0)
                res += "/";
            if(i == 1 && len>2)
                res += "(";
            res += to_string(nums[i]);
            if(i == len-1 && len>2)
                res += ")";
        }
        return res;
    }
};
ICRA12_A Real-Time Motion Planner with Trajectory Optimization for Autonomous Vehicles.pdf IEEE_CASE2014_Design of Lane Keeping System Using Adaptive Model Predictive Control.pdf IEEE_CDC2012_Werling_AutomaticCollisionAvoidanceUsingModel-predictiveOnlineOptimization.pdf IEEE_ICRA2010_werling-optimal-trajectory-generation-for-dynamic-street-scenarios-in-a-frenet-frame.pdf IEEE_IROS2016_Snider_Automated Tactical Maneuver Discovery, Reasoning and Trajectory Planning for Automated Driving.pdf IEEE_ITSC2005_A new approach to lane guidance systems.pdf IEEE_ITSC2011_Algebraic nonlinear estimation and flatness-based lat lon conrol or automotive vehicles.pdf IEEE_ITSC2011_The H2-Optimal Preview Controller for a Shared Lateral Control.pdf IEEE_ITSC2013_Linear Model Predictive Control for Lane Keeping and Obstacle Avoidance on Low Curvature Roads.pdf IEEE_ITSC2016_Optimal Trajectory Planning for Autonomous Driving Integrating Logical Constraints_An MIQP Perspective.pdf IEEE_IV2010_Safety Verification of Autonomous Vehicles for Coordinated Evasive Maneuvers.pdf IEEE_IV2012_Learning Lane Change Trajectories From On-road Driving Data.pdf IEEE_IV2013_Higher_Order_Sliding_Mode_Control_for_Lateral_Dynamics_V0.pdf IEEE_IV2013_Robust Predictive Control for Semi-Autonomous Vehicles with an certain drivier model.pdf IEEE_IV2013_Snider_Focused Trajectory Planning for Autonomous On-Road Driving.pdf IEEE_TransHMS2017_Modeling, Identification, and Predictive Control of a Driver Steering Assistance System.pdf IEEE_TransSMC_2009Combined Automatic Lane-Keeping and Driver's Steering Through a 2-DOF Control Strategy.pdf" IEEE-TransIE2014_A real time energy optimal trajectory generation method for a servomotor system.pdf IEEE-TransITS2014_Ziegler_Making Bertha Drive-An Autonomous Journey on a Historic Route.pdf IJRR_Journal_2012_Werling_Optimal-trajectories-for-time-critical-street-scenarios-using-discretized-terminal-manifolds.pdf IROS_2015_Tunable and Stable Real-Time Trajectory Planning for Urban Autonomous Driving.pdf AI Model for Behaviour Arbitration.pdf Automatic_Steering_Methods_for_Autonomous_Automobile_Path_Tracking.pdf AVEC_2015_Lane Keeping Assistance with Learning-Based Driver Model and Model Predictive Control.pdf hoffmann_stanley_control07.pdf IAS_2014_On-Road Trajectory Planning for General Autonomous Driving with Enhanced Tunability.pdf ICINCO_2017_Time-Energy Optimal Trajectory Planning over a Fixed Path for a Wheel Mobile Robot.pdf ICIRA2012_On-Road Motion Planning for autonomous driving.pdf ICRA_2011_Energy-Optimal Velocity Profiles for Car-Like Robots.pdf
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值