10 2012 档案

一道概率题
摘要:问题:一副扑克牌54张,随机打乱之后排成一叠,从上到下一次翻(摸)一张牌,直到翻到一张k为止。问:下一张牌是黑桃k的概率大还是黑桃3的概率大?分析一下这个题目,可以发现题目有歧义(既然是条件概率,那已知的条件有哪些呢?):题目理解1。如果只有一个人在翻牌,那他肯定知道第一张k是不是黑k,也肯定知道黑3有没有翻出来,也肯定知道还剩多少张牌。有了这些数据,算下一张牌是黑3还是黑k的概率就容易些了。题目理解2。如果有两个人,一个人翻牌,另一个人不许看。当翻牌的人翻出了第一张k,而且不告诉另一个人是什么k,且不告诉他翻了多少张之类的。仅仅告诉另一个人翻出了一张k。这时问另外一个人下一张牌是黑3的概率大 阅读全文

posted @ 2012-10-31 22:04 Torstan 阅读(461) 评论(0) 推荐(0) 编辑

mutex and condition variable
摘要:mutex and condition variable 阅读全文

posted @ 2012-10-29 16:44 Torstan 阅读(84) 评论(0) 推荐(0) 编辑

virtual inheritance
摘要:Virtual inheritance is used to solve the problem of diamonds inheritance, 2 instance of base objects, in multiple inheritance. With the knowledge on c++ object model, we can understand virtual inheritance easily. Here is a sample code.#include<iostream>using namespace std;class Point2D_IF{ pub 阅读全文

posted @ 2012-10-23 18:20 Torstan 阅读(201) 评论(0) 推荐(0) 编辑

virtual destructor
摘要:code 1.#include <iostream>using namespace std;class Base { public: Base() {cout<<"Base constructor"<<endl;} ~Base() {cout<<"Base destructor"<<endl;}};class Derived:public Base{ public: Derived() {cout<<"Derived constructor"<<end 阅读全文

posted @ 2012-10-22 22:33 Torstan 阅读(169) 评论(0) 推荐(0) 编辑

导航

点击右上角即可分享
微信分享提示