NKPC7-2154-Birds attacks

Source: Internet
Author: User

1. Overview

This question is more complicated to discuss in detail. I use the three-point method in different ranges. In fact, the AC can be directly used by the three-point method.

2. Analysis

Assume that the horizontal speed is V1 and the vertical speed is V2.

Because the value range of V2 is [0, V], the first part on the right of the equation is monotonic decreasing. Because it is a convex quadratic function, the decreasing speed is faster and faster, the second part on the right of the equation is monotonic increasing. Because it is a concave quadratic function, the increasing speed is getting slower and slower. If the two functions are multiplied, there may be a tendency to increase first and then decrease.
This analysis is not convincing enough. In fact, the second part on the right side is multiplied separately and then transformed into the addition of the two curves. Then, the increase or decrease of S is more clear based on the position of the center line. However, the three-way method is over, and the pseudo code of the three-way method is mainly given.

3. Three-way

I didn't know what the trigger method was before. When I was doing this, I thought of finding a method with the maximum convex function value. Then I searched the internet, and the method I gave was the same, A little fun.
Known: the prototype of the function for calculating the convex function Value is int Value (int), and the scope of the defined domain is [0, V].

Left = 0, Right = V;
While (fabs (Right-Left)> 1e-6 |
Fabs (Value (Right)-Value (Left)> 1e-10)
{
Tmp1 = Left + (Right-Left)/3;
Tmp2 = Left + (Right-Left) * 2/3;
If (Tmp1 <Tmp2) Left = Tmp1;
Else Right = Tmp2;
}

When Tmp1 <Tmp2, it indicates that Tmp1 must be on the Left of the maximum value, so update Left. Otherwise, Tmp2 must be on the Right of the maximum value, so update Right.

4. Question URL

Http://acm.nankai.edu.cn/p2154.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.