LA6262 Darts 浮点数处理
来源:互联网 发布:最好的围棋软件 编辑:程序博客网 时间:2024/06/06 19:10
题目地址:LA6262
一个A+B水题
关键就是浮点数的处理
很担心恰好在某一条半径上啊。 觉得ceil(r-eps) 比较靠谱,防止刚好相同被当做超过了一点点。
#include<iostream>#include<cmath>#include<cstdio>const double eps=1e-8;using namespace std;struct Point{ double x; double y; Point(double x=0,double y=0):x(x),y(y) {} };//int getPoint(int x,int y)//{// for(int i=1;i<=10;i++)// //}int n;int main(){ int T; cin>>T; while(T--) { cin>>n; long long ans=0; double x,y; for(int i=0;i<n;i++) { scanf("%lf%lf",&x,&y); double r=sqrt(x*x+y*y); r/=20; int p=ceil(r-eps); if(!p) ans+=10; else if(p<=10) ans+=11-p; } cout<<ans<<endl; } }//struct Point//{// int x;// int y;// Point(int x=0,int y=0) :x(x),y(y) {}// //};////Point p[5005];////int main()//{// //}
0 0
- LA6262 Darts 浮点数处理
- 如何处理浮点数
- Format处理浮点数
- 浮点数处理
- VB的浮点数处理
- 计算机如何处理浮点数
- JavaScript 处理浮点数源码
- VB的浮点数处理
- 浮点数float 处理注意事项
- c++浮点数的处理
- 浮点数精度问题处理
- js 处理浮点数问题
- Darts
- Java中浮点数的处理
- JS中浮点数四舍五入的处理
- float浮点数的溢出处理
- JavaScript中的浮点数溢出情况处理。
- linux shell bc命令 处理浮点数
- UML类图关系详解
- POJ 3101 Astronomy
- Xcode 5 单元测试(二)OCMock和GHUnit
- 飞鸽传书如何在VMware下进行通信
- javaweb07-xml
- LA6262 Darts 浮点数处理
- 设计模式系列课程04之【里氏替换原则】
- treap
- [android lib]Android开源项目汇总-备用
- JavaScript中函数声明优先于变量声明
- CF:Problem 427C - Checkposts强连通Tarjan算法
- Android对SQLite批量添加数据
- Linux C 弹球游戏
- platform 总线