UVA 11817 Tunnelling the Earth
来源:互联网 发布:美国商业数据分析硕士 编辑:程序博客网 时间:2024/05/19 07:25
经度维度计算球面距离以及直线距离。模板模板。。
#include <map>#include <set>#include <queue>#include <stack>#include <math.h>#include <time.h>#include <stdio.h>#include <stdlib.h>#include <iostream>#include <limits.h>#include <string.h>#include <string>#include <algorithm>#define MID(x,y) ( ( x + y ) >> 1 )#define L(x) ( x << 1 )#define R(x) ( x << 1 | 1 )#define BUG puts("here!!!")#define STOP system("pause")using namespace std;const double pi = acos(-1.0);const double R = 6371009;double angle_3d(double lng1, double lat1, double lng2, double lat2){ double dlng = fabs(lng1 - lng2)*pi/180; while( dlng >= 2*pi ) dlng -= pi*2; if( dlng > pi ) dlng = 2*pi - dlng; lat1 *= pi/180; lat2 *= pi/180; return acos(cos(lat1)*cos(lat2)*cos(dlng) + sin(lat1)*sin(lat2));}int main(){ int ncases; double la,lb,wa,wb; scanf("%d", &ncases); while( ncases-- ) { scanf("%lf%lf%lf%lf",&la, &wa, &lb, &wb); double ang = angle_3d(wa, la, wb, lb); double l1 = ang*R; double l2 = R*sqrt(2 - 2*cos(ang)); printf("%.0lf\n", l1 - l2); }return 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
- 数据结构及算法学习总结(一)
- hdu 1166 敌兵布阵
- POJ 3668 Game of Lines
- 机房收费系统验收报告
- C++Primer学习笔记(二)
- UVA 11817 Tunnelling the Earth
- 新的开始
- html meta viewport
- Matlab安装中出现Real-Time Windows Target kernel是啥意思?
- hdu 1754 I Hate It
- 第一篇
- 关于Ax51的一个小程序(跟8086好像啊~~~怀念自学8086的那段苦日子)
- WEB开发有用工具:web-developer
- hdu 2795 Billboard