1 model (5) day2

Source: Internet
Author: User

Question 1:

What is the smallest positive integer x that makes x ^ x reach or exceed n digits? N <= 2*10 ^ 9

 

Problem solving process:

1. I have seen this question before. The number of digits of a number x = (INT) lg (x) + 1 is changed to Ln (X)/ln (2) + 1; then only one minimum X is required to meet Ln (X)/ln (2) + 1> = N;

2. Considering that ln (X)/ln (2) + 1 is monotonic increasing, we can solve the problem quickly as long as binary X is used.

 

Question 2:

Give n ordered queues and find the minimum m of all numbers. N, m <= 10 000

 

Problem solving process:

1. This question was also seen in the Noi guide .. Write a small root heap. At the beginning, the first element of each queue is written into the heap. Each time the top element of the heap is taken out, the next element of the corresponding queue is pushed into the heap .. I reviewed the heap again.

 

 

Question 3:

Multiply a matrix of a x B by a matrix of B x C to obtain a matrix of a X c. the time complexity is a x B x C. Matrix Multiplication satisfies the combination Law (but does not satisfy the exchange law ). Returns the size of N matrices in sequence. How long does it take to calculate the product of N matrices. N <= 100

 

Problem solving process:

1. This is the bare interval DP, Which is simpler than the merge of stones .. The specific implementation can be done by merging stones.

1 model (5) day2

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.