-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
【每日一题】- 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
Labels
Comments
认领 |
done |
kant-li
pushed a commit
to kant-li/leetcode
that referenced
this issue
Oct 18, 2019
romanbrickie
pushed a commit
to romanbrickie/leetcode-1
that referenced
this issue
Jan 20, 2020
azl397985856
pushed a commit
that referenced
this issue
Aug 19, 2023
azl397985856
pushed a commit
that referenced
this issue
Aug 19, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
小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)
The text was updated successfully, but these errors were encountered: