码迷,mamicode.com
首页 >  
搜索关键字:coins    ( 511个结果
HDU5985 Lucky Coins 概率dp
题意:给你N种硬币,每种硬币有Si个,有Pi 概率朝上,每次抛所有硬币抛起,所有反面的拿掉,问每种硬币成为最后的lucky硬币的概率。 题解:都知道是概率dp,但是模拟赛时思路非常模糊,很纠结,dp[10][1e6]这个状态让我觉得丝毫没有用,当时一直以为每种硬币是互相独立的。然后中间吃了个饭,回来 ...
分类:其他好文   时间:2018-09-21 23:17:14    阅读次数:363
LeetCode:零钱兑换【322】【DP】
LeetCode:零钱兑换【322】【DP】 题目描述 给定不同面额的硬币 coins 和一个总金额 amount。编写一个函数来计算可以凑成总金额所需的最少的硬币个数。如果没有任何一种硬币组合能组成总金额,返回 -1。 示例 1: 示例 2: 说明:你可以认为每种硬币的数量是无限的。 题目分析 很 ...
分类:其他好文   时间:2018-09-18 17:23:05    阅读次数:288
题解 CF58B 【Coins】
题目大意: 如果我们有一个数 $ n $ ,求一个数组,数组中的后一个数都是前一个数的因数,求一个数组元素最多的那个数组。 思路: 首先这个数列中的每一个数都是第一个数的因子 然后如果有一个数,我们都可以分解质因数,比如说下图 所以可以知道当这个数列中的数最多的情况的时候一定是每个数都是前一个数除以 ...
分类:其他好文   时间:2018-09-11 14:51:45    阅读次数:165
[pat]1068 Find More Coins
满背包问题,把体积和价值看成相等的。用滚动数组优化,然后额外开辟一个choice数组来记录每次的选择,然后回溯打印。因为要按字典序,先把价值进行排序。假如选最小的商品能装满m的话,那就把判断条件改成大于等于,然后最后来 选择最小的那个。 ...
分类:其他好文   时间:2018-09-05 23:46:11    阅读次数:194
138.Arranging Coins
题目: You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins. 您想要以楼梯形状形成总共n个硬币,其中每个第k行必须 ...
分类:其他好文   时间:2018-09-05 21:56:55    阅读次数:262
Coins I(ICPC2017 Urumqi)
题目描述 Alice and Bob are playing a simple game. They line up a row of n identical coins, all with the heads facing down onto the table and the tails upw ...
分类:其他好文   时间:2018-08-22 11:06:11    阅读次数:159
ACM-ICPC 2017 Asia Urumqi:A. Coins(DP)
挺不错的概率DP,看似基础,实则很考验扎实的功底 这题很明显是个DP,为什么???找规律或者算组合数这种概率,N不可能给的这么友善。。。 因为DP一般都要在支持N^2操作嘛。 稍微理解一下,这DP[i][j]还是不好想啊,首先是写DP[I][j]的含义 首先我们想这道题是要求一个最优决策下的期望,那 ...
分类:其他好文   时间:2018-08-22 01:12:14    阅读次数:131
[CC-ANUCBC]Cards, bags and coins
[CC ANUCBC]Cards, bags and coins 题目大意: 给你$n(n\le10^5)$个数,$q(q\le30)$次询问,问从中选取若干个数使得这些数之和为$m(m\le100)$的方案数。 思路: 不难想到一个比较暴力的动态规划,用$f[i][j]$表示用了前$i$个数,和为 ...
分类:其他好文   时间:2018-08-07 19:02:08    阅读次数:167
[LeetCode] 877. Stone Game == [LintCode] 396. Coins in a Line 3_hard tag: 区间Dynamic Programming, 博弈
Alex and Lee play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of sto ...
分类:其他好文   时间:2018-08-01 11:39:10    阅读次数:211
ACM-ICPC 2017 Asia Urumqi A. Coins
Alice and Bob are playing a simple game. They line up a row of n identical coins, all with the heads facing down onto the table and the tails upward. ...
分类:其他好文   时间:2018-07-31 22:10:50    阅读次数:197
511条   上一页 1 ... 10 11 12 13 14 ... 52 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!