Codeforces Round #300

Source: Internet
Author: User

A. Cutting Banner

Keywords: [read title] [string] [enum]

Pit point: can only subtract a certain string of the remaining in the original order to make up the "codeforces", and reduce the next section of "Codeforces" is not possible

e.g. "codefAAAAorces" is feasible and "AAcodeforcesAA" is not feasible

B. Quasi Binary

Test instructions: Give a number n, for a minimum of several shapes such as "1010" so that only the number of ' 0 ' and ' 1 ' are added

Keywords: [greedy]

Solution: Because each bit of n is reduced by up to 1 at a time, the total number is the largest of all the bits of N. If a bit of n is not 0, it will be reduced by 1, 0 will be unchanged, leading 0 will be removed, which is the number required each time.

C. Tourist ' s Notes

Test instructions: A person to climb the mountain, known n days of a M-day mountain climbing height, and adjacent two days of height difference $\leq 1$, ask this person in this n days climb the highest height is how much, if contradiction output-1

Keywords: [Mathematical formula]

Solution: Obviously if the two adjacent days of height difference is greater than the time difference must be "impossible". The highest height must appear between two adjacent points of time. Set the adjacent two time points for $dx,dy (dx < DY) $, the height is $hx$, $hy $, when the highest point must be increased from $dx$ to the right, $dy $ left to increase the difference between the smallest point, set to $p (dx \leq P \leq dy) $. From $dx$ through $p$ days, $DX $ height $dpx = hx + p$, $dy $ height $dpy = hy + ((DY-DX)-p) $, $DPX = dpy$, Solution $p = (HY-HX+DY-DX)/2$, the highest height of this segment is $HX + p = (HY+HX-DY-DX)/2$, maintaining the m+1 segment (including tail)

D. Weird Chess

Test instructions

Codeforces Round #300

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.