码迷,mamicode.com
首页 >  
搜索关键字:coins    ( 511个结果
lintcode 中等题:Coins in a Line 硬币排成线
题目硬币排成线有n个硬币排成一条线。两个参赛者轮流从右边依次拿走 1 或 2 个硬币,直到没有硬币为止。拿到最后一枚硬币的人获胜。请判定第一个玩家是输还是赢?样例n =1, 返回true.n =2, 返回true.n =3, 返回false.n =4, 返回true.n =5, 返回true.挑战O...
分类:其他好文   时间:2015-11-12 17:50:14    阅读次数:422
Coin-row problem(1139)
Description There is a row of n coins whose values are some positive integers c?, c?,...,cn, not necessarily distinct. The goal is to pick up the m...
分类:其他好文   时间:2015-11-08 19:26:37    阅读次数:233
2015.10.16赛码联考题解,非正确,求大神指导。
//只AC了20%。说的就是11个位置一字型排开0-10。扔硬币到这些位置,然后有个帽子可以每次移动最多一个位置,初始位置5。//思考:相当于遍历一个3叉树。#include #include #include using namespace std;struct coins{ int x; int...
分类:其他好文   时间:2015-10-16 23:25:14    阅读次数:338
POJ 1742 Coins
《挑战程序设计竞赛》上DP的一道习题。很裸的多重背包。一开始我写的倍增,把C[i]分解成小于C[i]的2^x和一个余数r。dp[i][j]的定义前i个数字能否到凑出j来,改成一位滚动数组。#include#include#include#include#include#include#include...
分类:其他好文   时间:2015-10-15 22:08:11    阅读次数:242
LeetCode "Nim Game"
Same as LintCode 'Coins in a line'. Here is mind-flow: 4 is a definite lose, for (4 + 1), (4 + 2), (4 + 3), we can put the other player into slot 4 - ...
分类:其他好文   时间:2015-10-13 07:01:07    阅读次数:165
LintCode "Coins in a Line"
Recursion + Memorized Search(DP). And apparently, the code below can be iterative with only 3 vars - DP.class Solution { unordered_map cache;public...
分类:其他好文   时间:2015-10-03 13:12:54    阅读次数:169
Project Euler 78:Coin partitions
Coin partitions Let p(n) represent the number of different ways in which n coins can be separated into piles. For example, five coins can separated in...
分类:其他好文   时间:2015-10-02 22:31:20    阅读次数:260
Square Coins(母函数)
Square CoinsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9926Accepted Submission(s): 6806Proble...
分类:其他好文   时间:2015-09-20 11:57:36    阅读次数:137
POJ 1742 Coins
题意:给n种硬币,每种硬币的面额为Ai,个数为Ci,问用这些硬币最多能凑出多少种不大于m的面额。解法:男人八题之一……虽然我是个妹子但还是要做啊……_(:з」∠)_看起来是个多重背包……然而算了复杂度之后……呵呵……百度一下……被机智了一脸……n层循环,dp[i][j]表示用前i个硬币是否能表示面额...
分类:其他好文   时间:2015-09-14 19:21:32    阅读次数:125
pat1068. Find More Coins (30)
1068. Find More Coins (30)时间限制150 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueEva loves to collect coins from all over the universe, including s...
分类:其他好文   时间:2015-09-10 11:02:58    阅读次数:175
511条   上一页 1 ... 31 32 33 34 35 ... 52 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!