搞不定这种递归计算,可能我的头脑是“线性”的,这种一层一层的,想起来太费劲了,想的头发都没了。以后希望能有AI来写这种程序吧,AI不怕掉头发! 参考:https://leetcode.com/problems/distribute-coins-in-binary-tree/discuss/22193 ...
分类:
其他好文 时间:
2019-04-23 19:13:51
阅读次数:
105
题目链接:https://codeforc.es/gym/101606/problem/F 题解: 假设 $f[i][j]$ 表示抛 $i$ 次硬币,有 $j$ 个硬币正面朝上的概率。 所以只有两种挑选硬币的情况: 1.正面硬币数量为 $[0,n-1]$,选择反面硬币抛,则正面硬币数量比原本增加 $ ...
分类:
其他好文 时间:
2019-04-14 09:41:06
阅读次数:
159
You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you nee ...
分类:
其他好文 时间:
2019-04-06 14:06:52
阅读次数:
132
链接:https://vjudge.net/problem/HDU-3348 题意: 给1,5,10,50,100面值的钞票个a张,求得到p的最小张数和最大张数, 不能则输出-1. 思路: 贪心,正常求最小张数,然后讲所有钞票能表示的总和,减去原本求的价值。 求这个的最小张数,剩下的则是原本价值的最 ...
分类:
其他好文 时间:
2019-03-30 01:28:02
阅读次数:
196
[TOC] 题目描述: 你总共有 n 枚硬币,你需要将它们摆成一个阶梯形状,第 k 行就必须正好有 k 枚硬币。 给定一个数字 n ,找出可形成完整阶梯行的总行数。 n 是一个非负整数,并且在32位有符号整型的范围内。 示例 1: 示例 2: 解法: ...
分类:
其他好文 时间:
2019-03-23 13:01:31
阅读次数:
135
# coding=utf-8# 递归class Solution1(object): def coinChange(self, coins, amount): """ :type coins: List[int] :type amount: int :rtype: int """ if not co ...
分类:
其他好文 时间:
2019-03-17 14:01:57
阅读次数:
136
1. {print} coins.txt 2. {print $x}: 打印第x列 用制表键对齐 ...
分类:
系统相关 时间:
2019-02-12 23:12:42
阅读次数:
324
https://pintia.cn/problem-sets/994805342720868352/problems/994805402305150976 Eva loves to collect coins from all over the universe, including some ot ...
分类:
其他好文 时间:
2019-02-11 14:12:24
阅读次数:
172
打印字符串:%s--------printf(“%s”,”abcd”); 打印字符串数组中某一位:%c--------printf(“%c”,”abcd[2]”); 字符的定义及打印格式: struct { int amount; char *name; }coins[] = { {1,"one"}... ...
分类:
编程语言 时间:
2019-02-10 00:10:31
阅读次数:
194
"HDU 3348" coins Description "Yakexi, this is the best age!" Dong MW works hard and get high pay, he has many 1 Jiao and 5 Jiao banknotes(纸币), some da ...
分类:
其他好文 时间:
2019-02-09 13:22:53
阅读次数:
178