csu oj 1539 数学公式
2015-05-14 00:19
190 查看
//csu oj 1539 space golf #include<iostream> #include<cstring> #include<cstdio> #include<cstdlib> #include<cmath> #define maxn 20000 #define inf 0x3f3f3f using namespace std; struct node { double x,y; }p[maxn]; double Min(double a,double b) { if(a>b) return b; else return a; } double Max(double a,double b) { if(a>b) return a; else return b; } int main() { int n,b; double d; while(scanf("%lf%d%d",&d,&n,&b)!=EOF) { double m=inf; for(int i=1;i<=n;i++) scanf("%lf%lf",&p[i].x,&p[i].y); for(int j=0;j<=b;j++) { double mi=0; double l=d/(double)(j+1); double miao=l/4.0; double tmp=sqrt((l*l/(8.0*miao))+2*miao); for(int i=1;i<=n;i++) { int tmp=p[i].x/l; double xx=p[i].x-(double)tmp*l; double ans1=(xx-l/2.0)*(xx-l/2.0); ans1=(ans1*4.0)/(l*l); ans1=1-ans1; ans1=p[i].y/ans1; double temp=sqrt((l*l/(8.0*ans1))+2*ans1); mi=Max(ans1,mi); } mi=Max(mi,l/4.0); double res=sqrt((l*l/(8.0*mi))+2*mi); m=Min(m,res); } printf("%.6lf\n",m); } }
相关文章推荐
- csu oj 1539 数学公式
- OJ_1186数学公式【在化简分数时调用函数进行化简】【简便方法】
- 杭电OJ(HDOJ)1018题:求n的阶乘位数(数学公式)
- 杭电OJ(HDOJ)2036题:改革春风吹满地(几何,数学公式)
- 哈理工OJ 1196 Marshal's confusion II(数学公式题)
- 使用LaTeX基本数学公式
- Codeforces Round #259 (Div. 1) A. Little Pony and Expected Maximum 数学公式结论找规律水题
- 常用数学公式
- 试试数学公式~
- 通过MathJax在页面上显示微积分等数学公式
- 【Light-oj】-1138 - Trailing Zeroes (III)(二分,数学)
- Win7附带的数学输入面板让输入数学公式更简单
- 一个很好的练数学思维的oj
- D 1041: [HAOI2008]圆上的整点 (数学推公式)
- 在PowerPoint课件中插入数学公式
- Markdown中插入数学公式的方法
- CSUOJ 1093 Caps Lock (CSU Monthly 2012 Aug. C)
- CSUOJ 1600 Twenty-four point (判断24点,另附给出表达式版)
- HDU 4024 Dwarven Sniper’s hunting(数学公式 或者是二分)
- Objective-C中math.h数学计算公式介绍