码迷,mamicode.com
首页 >  
搜索关键字:dice    ( 352个结果
菜鸟系列之C/C++经典试题(三)
设计包括min函数的栈 题目:定义栈的数据结构,要求加入一个min函数,可以得到栈的最小元素。要求函数min、push以及pop的时间复杂度都是O(1)。 分析:这是2006年google的一道面试题。 我看到这道题目时,第一反应就是每次push一个新元素时,将栈里全部逆序元素排序。这样栈顶元素将是 ...
分类:编程语言   时间:2017-05-16 14:38:55    阅读次数:182
zoj3329--One Person Game(概率dp第六弹:形成环的dp,带入系数,高斯消元)
One Person Game Time Limit: 1 Second Memory Limit: 32768 KB Special Judge There is a very simple and interesting one-person game. You have 3 dice, nam ...
分类:其他好文   时间:2017-05-07 11:32:51    阅读次数:224
hdoj 1159最长公共子序列
?? /*Common Subsequence A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1 ...
分类:其他好文   时间:2017-05-02 09:51:48    阅读次数:191
hdu4599Dice 概率dp+扩展欧几里得
//给一个正常的骰子 //F[n] 为这个骰子有一个数连续出现n次的期望 //h[n] 我这个骰子连续出现n个1的期望 //g[n] 为出现n个1的期望 //求最小的m1使得G(m1)>=F[n] , 最小的m2使得G(m2) >= H(n) //f[i] 一个数连续掷了i次,其F[n] //非常e ...
分类:其他好文   时间:2017-04-28 13:46:54    阅读次数:139
python 扔骰子
把一个骰子扔n次, n次朝上一面的点数和为s。 输入n, 打印出s的所有可能的值出现的概率。 1 from decimal import Decimal 2 3 def get_dice(): 4 # 一个骰子扔n次 5 times = input('please input an integer\ ...
分类:编程语言   时间:2017-04-24 21:21:47    阅读次数:267
Java设计模式之工厂模式
工厂设计模式,我们在工厂对象上调用的是创建方法,而该工厂对象将生成接口的某种实现的对象。理论上,通过这种方式,我们的代码完全与接口的实现分离,这使得我们透明的将某个实现替换为另一个实现。 比如利用工厂方法来执行抛硬币(Coin)和投骰子(Dice类)的功能。以下用2个方式来实现工厂模式。 第一种: ...
分类:编程语言   时间:2017-04-22 14:46:12    阅读次数:233
Codeforces Round #266 (Div. 2)C. Number of Ways
传送门 Description You've got array a[1],?a[2],?...,?a[n], consisting of n integers. Count the number of ways to split all the elements of the array into ...
分类:其他好文   时间:2017-04-21 09:49:33    阅读次数:178
Aeroplane chess(简单概率dp)
Hzz loves aeroplane chess very much. The chess map contains N+1 grids labeled from 0 to N. Hzz starts at grid 0. For each step he throws a dice(a dice ...
分类:其他好文   时间:2017-04-12 20:51:57    阅读次数:283
[leetcode]Two Sum
问题描写叙述: Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of t ...
分类:其他好文   时间:2017-04-12 12:25:05    阅读次数:161
1. Two Sum【数组|哈希表】
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex ...
分类:编程语言   时间:2017-03-27 00:30:34    阅读次数:193
352条   上一页 1 ... 20 21 22 23 24 ... 36 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!