UVA 11817 - Tunnelling the Earth
来源:互联网 发布:杨幂视频是真的吗 知乎 编辑:程序博客网 时间:2024/06/17 21:58
题目大意:输入两个点的纬度跟经度,要求求出这两个点的直线距离跟从地球表面的距离的差值。
思路:利用高中的立体几何知识……
代码如下:
#include<iostream>#include<cstdio>#include<iomanip>#include<cmath>using namespace std;const double pi=acos(-1);int main(){ // freopen("data.txt","r",stdin); ios::sync_with_stdio(false); int T; cin>>T; double radius=6371009; while(T--){ double x1,x2,y1,y2; cin>>x1>>y1>>x2>>y2; x1=x1/180*pi; x2=x2/180*pi; y1=y1/180*pi; y2=y2/180*pi; double r1=radius*sin(x1); double r2=radius*sin(x2); double BC=fabs(r1-r2); r1=radius*cos(x1); r2=radius*cos(x2); double ac2=r1*r1+r2*r2-2*r1*r2*cos(y1-y2); double AC=sqrt(ac2); double ab2=BC*BC+ac2; // cout<<ab2<<endl; double AB=sqrt(ab2); double arg=(radius*radius*2-ab2)/2/radius/radius; // cout<<"zzzz"<<arg<<endl; arg=acos(arg); double c=radius*arg; // cout<<arg<<' '<<c<<' '<<AB<<endl; double ans=c-AB; cout<<setiosflags(ios::fixed)<<setprecision(0)<<ans<<endl; } return 0;}
0 0
- UVA 11817 Tunnelling the Earth
- UVA 11817 Tunnelling the Earth
- UVa 11817 - Tunnelling the Earth
- UVA 11817 Tunnelling the Earth
- uva 11817 - Tunnelling the Earth
- UVa 11817 - Tunnelling the Earth
- UVA 11817 - Tunnelling the Earth
- UVA 11817 Tunnelling the Earth
- 球面距离 UVA 11817 Tunnelling the Earth
- UVa 11817 Tunnelling the Earth(球面距离)
- uva 11817 Tunnelling the Earth 球
- UVA 11817 - Tunnelling the Earth(球面)
- uva 11817 - Tunnelling the Earth(几何)
- UVA 11646 - Athletics Track || UVA 11817 - Tunnelling the Earth 几何
- UVa 11817 Tunnelling the Earth 计算球面距离
- Tunnelling the Earth - UVa 11817 几何球上的距离
- UVA11817 - Tunnelling the Earth
- The Earth Mover's Distance
- 概率论快速学习02:概率公理
- PHP-FPM 配置优化
- 行为型模式1:中介者模式
- 派生类构造函数的调用顺序
- opencv249 -- vs 2013配置
- UVA 11817 - Tunnelling the Earth
- php-fpm 启动参数及重要配置详解
- 添加分销商
- mysql存储过程语法及实例
- web安全学习笔记之-认证和会话管理-访问控制
- IDA破解Android程序的基本步骤
- C语言读取文件目录树
- Spring属性注入方式
- Dom4j解析XML