CSU 1602 Needle Throwing Game (投针问题)
2015-05-08 21:20
190 查看
1602: Needle Throwing Game
Time Limit: 5 Sec Memory Limit: 128 MBSubmit: 48 Solved: 25
[Submit][Status][Web Board]
Description
There are many parallel lines on the ground with the distance of D between each adjacent two. Now, throwing a needle randomly on the ground,please calculate the possibility of that the needle can be across one of the lines.#include<cstdio> #include<iostream> #include<cstring> #include<cmath> #include<stdlib.h> #include<vector> #include<queue> #include<stack> #include<algorithm> using namespace std; const double PI=acos(-1.0); int main() { double D,L,P; while(scanf("%lf %lf",&D,&L)!=EOF) { if(L<D) P=2*L/(PI*D); else P=1+(2.0/PI)*((L*1.0/D)*(1-sqrt((1-(D*D)/(L*L))))-asin(D*1.0/L)); P=P*10000; printf("%d\n",(int)P); } return 0; }
View Code
相关文章推荐
- CSU1602: Needle Throwing Game(投针问题)
- Apple GameCenter部分机器无法登陆沙盒的问题(Domain=GKErrorDomain Code=2)
- CSU 1086 超市购物 分组背包问题
- POJ 2598 Match Throwing Game 笔记
- 两个以上gameobject同时调用同一函数时候transform代码中改变但是实际效果并不改变的诡异问题
- GMS2(Gamemaker Studio 2)运行工程时遇到的问题解决
- Game (子串问题 模板)
- CSU-ACM2017暑期训练1-Debug与STL -圆桌问题
- CSUOJ 1542 线段树解决括号反向问题
- xcode下代码转vs问题之error C2440: “类型转换”: 无法从“void (__thiscall GameScene::* )(void)”转
- 洛谷P1602 Sramoc问题
- CSU---1086 多维01背包问题[DP]
- CSU 1290 DP解决数学期望问题
- HDU-1034 Candy Sharing Game 模拟问题(水题)
- 约瑟夫环问题——(Hdu-5643,King's Game)
- 遇到的种种问题1602 24C02
- 关于Microsoft Visual Studio 2010 使用 APP GAME KIT中遇到的问题
- CSU 1000/1001/1002 A+B问题
- cocos2d-x-2.2/samples/Cpp/SimpleGame/ 问题
- CSU 1780 简单的图论问题?