栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

zoj 2748 Free Kick

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

zoj 2748 Free Kick

#include <iostream>#include <cstdio>#include <cmath>using namespace std;const double EPS = 1E-9, Pi = atan(1.0) * 4.0;struct Point{double x, y;Point(double _x = 0, double _y = 0): x(_x), y(_y) {}friend double DIS (const Point& a, const Point& b){return pow(a.x-b.x, 2.0) + pow(a.y-b.y, 2.0);}};int main(){double a, W, x, y, D, A;while (~scanf("%lf%lf%lf%lf%lf%lf", &a, &W, &x, &y, &D, &A)){A = A * Pi / 180;double aa = DIS(Point(x, y), Point(-a, 0)), bb = DIS(Point(x, y), Point(a, 0)), cc = DIS(Point(a, 0), Point(-a, 0));double cita = (aa + bb - cc) / (2 * sqrt(aa*bb));cita = (acos(cita) - A) * 0.5;if (cita < 0){puts("0");continue;}double dd = tan(cita) * D * 2.0;int n = dd / W;if (!(fabs(dd / W - n) < EPS))n++;printf("%dn", n);}return 0;}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/378576.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号