Cdoj 1348 pillars and salted fish (bare 01 backpack)

Source: Internet
Author: User

the prince and the salty fish Time limit:1000/1000ms (java/others) Memory limit:120000/120000kb (java/others) Submit Status

One day, meow haha village, the pillars in their own room, face Magic mirror

"Magic Mirror, Magic Mirror, what is the most powerful martial arts in the world." "

In a moment, a thunder fell, the pillars of the front unexpectedly came out of an ancient black books, and the name of the book is "Salted Fish Martial" "" Salty fish Martial "!

Open a look, the first page of the book impressively read: "Practice to large into a variable body of salted fish King, control thunder and lightning." Practice to big into variable body salted fish king, control thunder and lightning. “

See this sentence, the prince immediately decided to cultivate salted fish martial.

Since it is the martial, it is not so good practice, so the column master decided to well plan his own cultivation process.

The column I have nn point mood value, and salted fish martial arts have mm a moves, for each moves, the column ye must consume Titi point mood value to master, at the same time the column ye will get the cultivation value of Vivi

So what is the maximum amount of cultivation that the Lord can get? Input

The first line of two integers nn,mm, respectively, indicating the mood points of the Lord and the number of moves of salted fish

Next mm line, 2 per line

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.