Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix continued fraction sqrt code#962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
adamant-pwn merged 3 commits intocp-algorithms:masterfrombqi343:master
Nov 29, 2022

Conversation

bqi343
Copy link
Contributor

The original code gives runtime error onn = 3. The updated code was tested onTavrida NU Akai Contest - Continued Fraction.

@adamant-pwn
Copy link
Member

adamant-pwn commentedNov 29, 2022
edited
Loading

Thanks for noticing! There is much simpler fix though (see my commits) :)

@adamant-pwnadamant-pwn merged commit19c7a40 intocp-algorithms:masterNov 29, 2022
@bqi343
Copy link
ContributorAuthor

bqi343 commentedNov 29, 2022
edited
Loading

it seems that the variable naming used in the solution is not consistent with the explanation though.

Also, I observed that(x + y*n0)//z == math.floor(x + y * math.sqrt(n)) // z always seems to hold for the given initialization ofx,y, andz. Why is this the case? (It's not true if we are allowed to initializex,y, andz arbitrarily.)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@bqi343@adamant-pwn

[8]ページ先頭

©2009-2025 Movatter.jp