【CodeForces】gym-101205B Curvy Little Bottles (2012 ACM-ICPC World Finals B)
来源:互联网 发布:淘宝盖楼等级不够 编辑:程序博客网 时间:2024/04/28 21:42
在f(x)是多项式情况下
推出以上然后就可以做了,第二部分可以二分做
(代码很丑,是打广工训练的时候“抢”时间写的……)
#include<stdio.h>#define eps 0.000001double a[23],b[23],xlow,xhigh,inc,l,r,mid;int T,n,cs;double pow(double a,int b){ double rt=1; while (b--) rt*=a; return rt;}inline double V(double x){ double rt=0; for (int i=0;i<=2*n;i++) rt+=3.1415926535*b[i]/(i+1)*(pow(x,i+1)-pow(xlow,i+1)); return rt;}inline void prepare(){ for (int i=0;i<=20;i++) b[i]=0;}int main(){ while(~scanf("%d",&n)) { cs++; prepare(); for (int i=0;i<=n;i++) scanf("%lf",a+i); for (int i=0;i<=n;i++) for (int j=0;j<=n;j++) b[i+j]+=a[i]*a[j]; scanf("%lf%lf%lf",&xlow,&xhigh,&inc); printf("Case %d: ",cs); printf("%.2f\n",V(xhigh)); double fxxk=xlow; for (int i=1;i<=8;i++) { l=xlow;r=xhigh; for (mid=(l+r)/2;l+eps<r;mid=(l+r)/2) if (V(mid)<inc) l=mid;else r=mid; if (l+eps<xhigh || inc<eps+V(l)) printf("%.2f ",(xlow=l)-fxxk); else { if (i==1) printf("insufficient volume"); break; } } puts(""); }}
0 0
- 【CodeForces】gym-101205B Curvy Little Bottles (2012 ACM-ICPC World Finals B)
- ACM/ICPC World Finals 2012 B Curvy Little Bottles
- 【ACM ICPC World Finals 2012】 Curvy Little Bottles (二分)
- 130716ACM-ICPC World Finals, 2012练习赛Curvy Little Bottles
- Curvy Little Bottles——ACM icpc 2012 word final problem B
- Gym 101205 (ACM-ICPC World Finals 2012)
- ACM-ICPC World Finals 2017
- ACM/ICPC World Finals 2012 D Fibonacci Words
- Curvy Little Bottles-二分和积分
- ACM-ICPC 2013 World Finals 简单题解
- Puzzle, ACM/ICPC World Finals 1993, UVa227
- ACM/ICPC World Finals 2013 D Factors
- ACM/ICPC World Finals 2010 D Castles
- Puzzle,ACM/ICPC World Finals 1993,UVa227
- Puzzle,ACM/ICPC World Finals 1993, UVa227
- Sqaures, ACM/ICPC World Finals 1990, UVa
- CodeForces Gym 100114B
- CodeForces Gym 100735B
- Tornado 学习之路 -- 开始
- PWM 捕获3
- 剑指Offer(6)______旋转数组的最小数字
- 性能优化_____MySql海量数据访问处理
- 【数据结构_树_Tree_0983】利用二叉树中序和后序遍历确定二叉树的先序遍历
- 【CodeForces】gym-101205B Curvy Little Bottles (2012 ACM-ICPC World Finals B)
- kindeditor 使其支持配置上传路径,限制上传图片大小(java)
- 工业镜头的选型
- 图像特征提取三大法宝:HOG特征,LBP特征,Haar特征
- 欧拉函数的应用(2)——欧拉函数与欧拉定理的结合
- Hadoop Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.8.1:jar
- 小白算法学习:求解两个字符串的最长公共子序列
- STM32 PWM 捕获4
- @RawResponseBody和@ItemsResponseBody两个方法体注解的区别