Educational Codeforces Round (rated for Div. 2) B. Weird subtraction process[number theory/Euclidean algorithm]

Source: Internet
Author: User
Tags integer division

Https://zh.wikipedia.org/wiki/%E8%BC%BE%E8%BD%89%E7%9B%B8%E9%99%A4%E6%B3%95

The same is true of the model, when it is reduced several times.

In Euclid's initial description, the quotient and remainder are computed by successive subtraction, that is, the R K −1 is subtracted from the Rk −2 until it is less than Rk− 1. A more efficient approach is to use integer division and modulo to compute quotient and remainder:

R k ≡ r k−2 mod r k−1
subtraction version defined in Euclid , the take remainder operation is subtracted and replaced

Educational Codeforces Round (rated for Div. 2) B. Weird subtraction process[number theory/Euclidean algorithm]

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.