0


算法第五天-01的概率问题+mysql复习

01由不等概率转变为等概率:

packageRandom.随机函数;/**
 * 不等概率的01----->等概率01
 */publicclassTest2{publicstaticintx(){returnMath.random()<0.84?0:1;}/**
     * 等概率的01   先判断一次,ans要是是0,在判断一次,要是还是0,返回0,要是1就重来一次,同理1也这样,01就是等概率
     * @return
     */publicstaticinty(){int ans =0;do{
            ans =x();}while(ans==x());return  ans;}}

··································································································

········································分割线·················································

··································································································

MYSQL

请添加图片描述
请添加图片描述
请添加图片描述

这个题是三个表,我们的思维就是化成两个表,将其中两个表通过内连接合并,然后再和第一个表左连接查询

SELECT e.last_name, e.first_name, b.dept_name
FROM employees AS e
LEFTJOIN(SELECT d.dept_no,d.dept_name,de.emp_no
FROM departments AS d
INNERJOIN dept_emp AS de
ON d.dept_no=de.dept_no
)AS b
ON e.emp_no=b.emp_no;
标签: 算法

本文转载自: https://blog.csdn.net/justleavel/article/details/124941718
版权归原作者 夜色架构师 所有, 如有侵权,请联系我们删除。

“算法第五天-01的概率问题+mysql复习”的评论:

还没有评论