Project Euler 613 Pythagorean Ant(概率+积分)
题目链接:点击我打开题目链接
题目大意:
给你一只蚂蚁,它在一个 边长为 \(30-40-50\) 的直角三角形\((x,y)\)上,并且它在直角三角形中选择的位置和移动方向的概率都是相等的。问你这只蚂蚁在最长的边上走出去的概率是多少?
注意:以下是题目的解析。
如果你想要享受做数学题的乐趣就不要看下面了啦。(╯ ̄Д ̄)╯╘═╛ (其实看了也无所谓...)
简要题解:

我们假设蚂蚁在 $ A(x,y) $ 点。
枚举一下题意,画一下图...( 随手画的...丑了点...)
我们可以得到:
\(\alpha=\arctan(\frac{x}{40-y})\)
\(\alpha+\beta=\arctan(\frac{30-x}{y})\)
\(\beta=\arctan(\frac{30-x}{y})-\arctan(\frac{x}{40-y})\)
\(\theta=\pi-\left(\arctan(\frac{30-x}{y})-\arctan(\frac{x}{40-y})\right)\)
\(f(x,y)=\frac{\theta}{2\pi}=\frac{1}{2}-\frac{1}{2\pi}*\left(\arctan(\frac{30-x}{y})-\arctan(\frac{x}{40-y})\right)\)
最后积分一下,所以概率就为:
\(ans = \frac{1}{600}*\int_0^{30}\int_0^{40-\frac{40x}{30}}\left[\frac{1}{2}-\frac{1}{2\pi}*\left(\arctan(\frac{30-x}{y})-\arctan(\frac{x}{40-y})\right)\right]\,\mathrm{d}x\mathrm{d}y\)
直接用 \(mma\) ,就很愉快地拿到了\(rank\) \(7\)th啦。
Project Euler 613 Pythagorean Ant(概率+积分)的更多相关文章
- Project Euler 389 Platonic Dice (概率)
题目链接: https://projecteuler.net/problem=389 题意: 掷一个正四面体骰子,记点数为\(T\). 掷\(T\)个正六面体骰子,记点数和为\(C\). 掷\(C\) ...
- Python练习题 037:Project Euler 009:毕达哥拉斯三元组之乘积
本题来自 Project Euler 第9题:https://projecteuler.net/problem=9 # Project Euler: Problem 9: Special Pythag ...
- [project euler] program 4
上一次接触 project euler 还是2011年的事情,做了前三道题,后来被第四题卡住了,前面几题的代码也没有保留下来. 今天试着暴力破解了一下,代码如下: (我大概是第 172,719 个解出 ...
- Python练习题 029:Project Euler 001:3和5的倍数
开始做 Project Euler 的练习题.网站上总共有565题,真是个大题库啊! # Project Euler, Problem 1: Multiples of 3 and 5 # If we ...
- Project Euler 9
题意:三个正整数a + b + c = 1000,a*a + b*b = c*c.求a*b*c. 解法:可以暴力枚举,但是也有数学方法. 首先,a,b,c中肯定有至少一个为偶数,否则和不可能为以上两个 ...
- Project Euler 44: Find the smallest pair of pentagonal numbers whose sum and difference is pentagonal.
In Problem 42 we dealt with triangular problems, in Problem 44 of Project Euler we deal with pentago ...
- project euler 169
project euler 169 题目链接:https://projecteuler.net/problem=169 参考题解:http://tieba.baidu.com/p/2738022069 ...
- 【Project Euler 8】Largest product in a series
题目要求是: The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × ...
- Project Euler 第一题效率分析
Project Euler: 欧拉计划是一系列挑战数学或者计算机编程问题,解决这些问题需要的不仅仅是数学功底. 启动这一项目的目的在于,为乐于探索的人提供一个钻研其他领域并且学习新知识的平台,将这一平 ...
随机推荐
- nginx 实现跨域
nginx 添加头部跨域. location / { add_header 'Access-Control-Allow-Origin' '*'; //允许的域 add_header 'Access-C ...
- react入门安装
react的入门安装 1.react的适用方法有两种,其一是依赖在线的cdn地址: https://reactjs.org/docs/cdn-links.html 官方给的cdn地址如下 <sc ...
- 【hdu 1429】胜利大逃亡(续)
[Link]: [Description] 给你一个n*m的格子; 里面有钥匙,以及钥匙能开的门; 以及墙,以及起点,以及出口; 问你从起点出发,到出口的话,能不能在t时间内到; [Solution] ...
- 如日中天的Uber到底是用什么开发语言做到的?
Uber将正在蓬勃发展的Go和Node.js这两个语言很好的融合到其系统上面来.Uber的站点可靠性project师Tom Croucher在近期于波兰举行的Node.js互动大会上详尽的对该公司所用 ...
- 运行maven项目出现的报错
java问题:严重: Error configuring application listener of class org.springframework.web.context.Cont 解决方案 ...
- javascript中易犯的错误有哪些
javascript中易犯的错误有哪些 一.总结 一句话总结: 比如循环中函数的使用 函数中this的指向谁(函数中this的使用) 变量的作用域 1.this.timer = setTimeout( ...
- javafx HTMLEditor
public class EffectTest extends Application { //===================== private final String INITIAL_T ...
- 解决 Ubuntu 下解压 .zip 文件时出现乱码
Ubuntu 下解压含中文名的 .zip 文件时,有时候会出现乱码的情况.我们可以通过下列命令来解决此类问题: $ unzip -O CP936 xxx.zip 原文网址 http://www.cnb ...
- [TypeScript] Shallow copy object by using spread opreator
For example we have an object: const todo = { text: "Water the flowers", completed: false, ...
- go reflect 调用方法
package main import ( "fmt" "reflect" ) type A struct { } func (A) Test() { fmt. ...