Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

例题8-12,UVa12627的一部分代码有问题 #35

Open
GavinSun0921 opened this issue Jan 24, 2019 · 0 comments
Open

例题8-12,UVa12627的一部分代码有问题 #35

GavinSun0921 opened this issue Jan 24, 2019 · 0 comments

Comments

@GavinSun0921
Copy link

虽然代码中没有用到g(k, i)这个函数,但其计算方式出现错误
if (i >= k2) return g(k - 1, i - k2) + count(k - 1);这是源代码中的那个式子
但实际应为if (i >= k2) return g(k - 1, i - k2) * 2 + count(k - 1);
仔细想象一下并不困难,左下角一个整体的方块,加上上面两块残缺的区域
这道题用的f(k, b) - f(k, a - 1)来表示的答案
同理答案也等于g(k, l - a + 1) - g(k, l - b), l is 1 << k

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant