[HDOJ5451] Best Solver (WTF)

Source: Internet
Author: User
Tags square root

Title: http://acm.hdu.edu.cn/showproblem.php?pid=5451

Analysis: a=5+2 Radical root 6 b=6-2 square root 6

N=1+2^x

So A^n+b^n is an integer.

Notice the 0<b^n<1

So ans=a^n+b^n-1

The result form is similar to the Fibonacci structure.

So construct an=p*an-1+q*an-2

Inverse feature root get recursive an=10* (an-1)-(an-2)

N is too large to be able to quickly power a matrix

Note M is very small, so the mold comes out certainly has the circulation section, the link biggest is also m*m, can withstand

Finally, the problem of the 1+2^x membrane Circulation Festival, the rapid Power solution

[HDOJ5451] Best Solver (WTF)

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.