ZOJ 2855 Google Map
2016-02-19 20:21
465 查看
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2855
#include <iostream> #include <queue> #include <set> #include <vector> #include <cstring> #include <cstdio> #include <string> #include <cstring> #include <algorithm> #include <string.h> #include <cmath> using namespace std; #define PI acos(-1) double getX(double longitude){ return longitude * PI / 180; } double getY(double latitude){ return log(tan(PI / 4.0 + (latitude * PI / 180.0) / 2)); } int main() { double lo, la , t; while (cin >> lo >> la >> t){ cout << "t"; double up = getY(85); double down = getY(-85); double left = getX(-180); double right = getX(180); double x = getX(lo); double y = getY(la); while (t--){ if (x < (left+right) / 2){ //确定左右,左 right = (left + right) / 2; if (y > (up+down) / 2){ //在上面 cout << "q"; down = (up + down) / 2; } else{ cout << "t"; up = (up + down) / 2; } } else{ //右边 left = (left + right) / 2; if (y > (up + down) / 2){ cout << "r"; down = (up + down) / 2; } else { cout << "s"; up = (up + down) / 2; } } } cout << endl; } }
相关文章推荐
- 几种malloc实现原理 ptmalloc(glibc) && tcmalloc(google) && jemalloc(facebook)
- NetLogon事件ID:5722
- NetLogon事件ID:5723
- golang走起(四)执行命令行
- golang走起(三)list简单使用和interface{}
- GoDaddy开通中文客服电话,沟通不再是问题
- golang走起(二)对象与指针二
- golang走起(一)对象与指针
- Google反编译新工具——Enjarify
- uva 11054 Wine trading in Gergovia
- [golang note] 数组切片
- golang笔记——IDE
- mongo 命令
- learning Go
- Guava学习笔记:Google Guava 类库简介
- poj2195 Going Home
- 被拒--悲剧之ORA-01017: invalid username/password; logon denied 错误
- 由引入 Google Protobuf 引发的工程管理思考
- goto函数
- 忘记Django登陆账号和密码的处理方法