Skip to content

【每日一题】- 2019-10-11 - 拼凑硬币 #198

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

Closed
azl397985856 opened this issue Oct 11, 2019 · 3 comments
Closed

【每日一题】- 2019-10-11 - 拼凑硬币 #198

azl397985856 opened this issue Oct 11, 2019 · 3 comments
Assignees

Comments

@azl397985856
Copy link
Owner

小Q十分富有,拥有非常多的硬币,小Q拥有的硬币是有规律的,对于所有的非负整数K,小Q恰好各有两个面值为2^k的硬币,所有小Q拥有的硬币就是1,1,2,2,4,4,8,8.....小Q有一天去商店购买东西需要支付n元钱,小Q想知道有多少种方案从他拥有的硬币中选取一些拼凑起来恰好是n元(如果两种方案某个面值的硬币选取的个数不一样就考虑为不一样的方案)

输入:

输入包括一个整数n(1<=n<=10^18),表示小Q需要支付多少钱,注意n的范围

输出:

输出一个整数,表示小Q可以拼凑出n元钱的方案数

样例输入:6

样例输出:3 (例如4+2, 4+1+1, 2+2+1+1)

@zhangjinyang
Copy link
Contributor

认领

@azl397985856
Copy link
Owner Author

认领

done

@azl397985856
Copy link
Owner Author

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

No branches or pull requests

2 participants