精度问题
来源:互联网 发布:lovelive日服卡牌数据 编辑:程序博客网 时间:2024/04/30 22:59
ZOJ 3488 Conic Section
由于所给数据无非4种情况
只要考虑a,c即可,但要注意精度问题
#include<iostream>#include<cstdio>#include<cmath>using namespace std;int main(){ int t; cin>>t; while(t--) { double a,b,c,d,e,f; cin>>a>>b>>c>>d>>e>>f; if(a*c==0)printf("parabola\n"); else if(a*c<0)printf("hyperbola\n"); else { if(fabs(a-c)<0.000001)printf("circle\n"); else printf("ellipse\n"); } }return 0;}
ZOJ1058 已知利率表 计算转换到最后的值 ,每次转换精确到 美分
#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<iostream>#define pi 3.1415926using namespace std;double f(double x){ x=(int)(x*100+0.5); x/=100; return x;}int main(){ int t; cin>>t; double rat[6][6]; while(t--) { int i,j; for(i=1;i<=5;i++) { for(j=1;j<=5;j++)cin>>rat[i][j]; } int n,city[100000]; city[0]=1; double ans; while(cin>>n&&n) { for(i=1;i<=n;i++) { cin>>city[i]; } city[n+1]=1; cin>>ans; ans=f(ans); for(i=1;i<=n+1;i++) { ans=ans*rat[city[i-1]][city[i]]; ans=f(ans); } printf("%.2lf\n",ans); } if(t>0)printf("\n"); } return 0;}
0 0
- 【精度问题】
- 精度问题
- 精度问题
- 精度问题
- 精度问题
- 精度问题
- DecimalFormat精度解决,商业运算精度问题
- 单精度与双精度问题
- DecimalFormat精度解决,商业运算精度问题
- 关于double精度问题
- double,float精度问题
- Exponentiation-计算精度问题
- JavaScript精度问题
- 高精度的精度问题
- number精度问题
- java 精度计算问题
- 价格精度问题
- 精度问题啊。。
- Linux下安装DB2数据库详解
- Silverlight ListBox 控件使用介绍
- ASP.NET中参数化查询
- Gpu如何将旋转后的buffer方向告诉给Surfaceflinger
- 最近不知道记录写什么
- 精度问题
- difference between <? super T> and <? extends T> in Java
- Linux下卸载DB2数据库详解
- 第四周作业——图的表示
- window7 32位 xampp 配置 memecach
- Storm On YARN
- eclipse内存溢出报错:java.lang.OutOfMemoryError:Java heap space.
- C++变量命名规则
- fedora下安装mplayer