码迷,mamicode.com
首页 >  
搜索关键字:using password: yes    ( 53562个结果
[C++基础]随机数,随机种子数
#include #include #include using namespace std; void Test() { int ran_num = 0; cout<<"不指定seed, "; for(int i=0; i<10;i++) { ran_num = rand()%6; cout<<ran_num<<" "; ...
分类:编程语言   时间:2014-06-25 20:02:59    阅读次数:206
LeetCode 28 Divide Two Integers
Divide two integers without using multiplication, division and mod operator. 思路:1.先将被除数和除数转化为long的非负数,注意一定要为long,因为Integer.MIN_VALUE的绝对值超出了Integer的范围。           2.常理:任何正整数num都可以表示为num=2^a+2^b+2^c+.....
分类:其他好文   时间:2014-06-25 19:46:17    阅读次数:246
Peterson和多线程版本
Peterson's algorithm (AKA Peterson's solution) is a concurrent programming algorithm for mutual exclusion that allows two processes to share a single-use resource without conflict, using only shar...
分类:编程语言   时间:2014-06-25 19:38:19    阅读次数:748
hdu-4405-Aeroplane chess-概率DP
还是那么做。。。 无非加了一条跳转。。。几乎都差不多。。 #include #include #include #include using namespace std; #define maxn 110000 #define eps 1e-6 #define zero(x) (fabs(x)<0?0:x) double dp[maxn]; int pre[maxn]; int n; dou...
分类:其他好文   时间:2014-06-25 00:24:29    阅读次数:351
zoj-3640-Help Me Escape-概率DP
dp[x]:能力为x的时候,逃出的期望。 则,可以根据x,来算出期望的公式。 #include #include #include #include using namespace std; #define maxn 110000 #define eps 1e-6 #define zero(x) (fabs(x)<0?0:x) double dp[maxn]; int c[maxn]; in...
分类:其他好文   时间:2014-06-24 23:43:09    阅读次数:289
LeetCode——Single Number
Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using e...
分类:其他好文   时间:2014-06-24 23:30:08    阅读次数:278
Effective C++:条款26:尽可能延后变量定义式的出现时间
(一) 那么当程序的控制流到达这个变量定义时,变承受构造成本;当变量离开作用域时,便承受析构成本。 string encryptPassword(const std::string& password) { using namespace std; string encrypted; if(password.length() < MinimumPasswordLengt) { t...
分类:编程语言   时间:2014-06-24 23:24:54    阅读次数:297
hdu-3853-LOOPS-概率dp
用记忆化写概率DP写的越来越纯真了。。 感觉记忆化很好写。。。 #include #include #include #include using namespace std; #define maxn 1100 #define eps 1e-6 #define zero(x) (fabs(x)<0?0:x) double mp[maxn][maxn][4]; double dp[maxn]...
分类:其他好文   时间:2014-06-24 22:07:09    阅读次数:278
hdu 3037 Saving Beans(组合数学)
hdu 3037 Saving Beans 题目大意:n个数,和不大于m的情况,结果模掉p,p保证为素数。 解题思路:隔板法,C(nn+m)多选的一块保证了n个数的和小于等于m。但是n,m很大,所以用到Lucas定理。 #include #include #include using namespace std; typedef long long ll; ll n, m,...
分类:其他好文   时间:2014-06-24 21:07:40    阅读次数:220
在命名空间下定义类型
在命名空间下定义类型   如果定义的类型要用于其他.NET 语言,应该把它们放在命名空间下,而不是模块中。这是因为模块在被编译成 C# 或其他.NET 语言时,被处理成类,在模块中定义的任何类型都成为这个类型内部的类。虽然对于 C# 来说,这并不是什么大问题,但是,如果用命名空间代替模块,C# 客户端代码看起来会更清晰。这是因为在 C# 中,只用using 语句导入(open)命名空间,而如果...
分类:其他好文   时间:2014-06-24 20:00:25    阅读次数:237
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!