![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
lovefreedom22
BUAA.SCSE
展开
-
用投针法估算概率
用投针法估算概率问题描述: x,y满足期望为mu,方差为sigma^2的正态分布,估算(x,y)落在(x^2+y^2-1)^3-x^2y^2=0内的概率。要求精确到小数点后1位。 c++代码:#include <iostream.h> #include <stdlib.h> #include <math.h> using namespace std; double gaussrand(){//生原创 2017-03-02 13:22:44 · 987 阅读 · 0 评论 -
删除多余的空格
题目要求:给定一个字符串,其中可能包含连续的空格,要求输出的字符串中,将大于1的连续空格转换为1个空格。 注:本代码没有经过系统测试,可能有bug,欢迎提出问题。 python代码:class Solution(object): def deleteSpace(self,s): if s == None or len(s) <=1: return原创 2017-03-13 09:23:50 · 297 阅读 · 0 评论