1341. Device

Time limit: 1.0 second
Memory limit: 64 MB
Major (M): You claimed that your device would be able to fly round the Earth several times and to miss not more than a couple of centimeters?
Designer (D); Yes! Our gravitational fields system of navigation absolutely...
M: Furthermore it can’t be fixed by detectors and doesn’t have a receiver or transmitter.
Engineer (E): It was your demand that nobody could detect the device...
M: We gave it a simple task to fly round the square. It didn’t return to the initial point.
D: Was that square large?
M: It’s none of your business! This is the State secret! You are to find the device!
Programmer (P): How did you programme the mission profile?
M: The device was to fly one conditional length unit to the North, the same distance to the East, the same distance to the South and then to the West. It passed more than 40 minutes since the device was to return. If they find it before us!.. In short, you are to find it!
D: It’s understood. Where was the initial point?
(The major flags and in two seconds the designer lies on the floor with his hands tied and two gunpoints look at his nape).
M: Why do you need this information?
E: You misunderstood! We don’t need information! But if we knew the initial point coordinates we could say where the device was...
(In two seconds two gunpoints look at the engineer’ nape, too).
M: Who interests this information? Where is the device? One, two, ...
P: You can’t understand! If the device reached the North Pole it can’t continue not to the North. Not to the East. Only to the South! Where the device is depends on where it started.
(Major aims at the programmer.)
M: No, it didn’t reach the Pole. It was taken into account.
P: Let me write a program that would count the final coordinates of the device. You’ll input the latitude, the longitude and the value of your conditional length unit yourself! The program would give you the answer keeping the absolute secrecy.
M: I’ll give you a chance. You three have got a computer and five hours... Less than five hours already. If we do not get the coordinates... You’ll suffer first.

Input

The first line contains the initial latitude W. –90 < W < 90. The second line – the initial longitude L, -180 < L ≤ 180. The third line contains the length of the square side, which the device was to fly round. The length is given in kilometers. The device keeps the fixed distance 6400 km from the Earth center of mass. The South Pole has latitude –90, the North Pole – latitude 90. The East direction is counted off the 0th meridian in the positive direction.

Output

You should output the final latitude and longitude of the device within three digits after a decimal point.

Sample

input output
  1. 56.846841
  2. 53.36673
  3. 1124.427
  1. 56.847
  2. 60.631
Problem Author: Stanislav Vasilyev
Problem Source: USU Championship 2004
Difficulty: 1115
 
题意:地球(R=6400km)表面有一个飞行器,先往北飞,再往东飞,再往南飞,再往西飞,都飞相同距离l。
 给定这个小东西的起始经纬度(北正南负东正西负),求飞完之后的经纬度。 
分析:
造成误差的原因是因为改变纬度后,所对应的圆的半径改变,造成相同距离而却有不同的经度变化。
那么算出各自的经度变化再相减就好。
我傻逼,一开始居然没想到怎么造成误差。
果然是数学喳喳。
  1. /**
  2. Create By yzx - stupidboy
  3. */
  4. #include <cstdio>
  5. #include <cstring>
  6. #include <cstdlib>
  7. #include <cmath>
  8. #include <deque>
  9. #include <vector>
  10. #include <queue>
  11. #include <iostream>
  12. #include <algorithm>
  13. #include <map>
  14. #include <set>
  15. #include <ctime>
  16. #include <iomanip>
  17. using namespace std;
  18. typedef long long LL;
  19. typedef double DB;
  20. #define For(i, s, t) for(int i = (s); i <= (t); i++)
  21. #define Ford(i, s, t) for(int i = (s); i >= (t); i--)
  22. #define Rep(i, t) for(int i = (0); i < (t); i++)
  23. #define Repn(i, t) for(int i = ((t)-1); i >= (0); i--)
  24. #define rep(i, x, t) for(int i = (x); i < (t); i++)
  25. #define MIT (2147483647)
  26. #define INF (1000000001)
  27. #define MLL (1000000000000000001LL)
  28. #define sz(x) ((int) (x).size())
  29. #define clr(x, y) memset(x, y, sizeof(x))
  30. #define puf push_front
  31. #define pub push_back
  32. #define pof pop_front
  33. #define pob pop_back
  34. #define ft first
  35. #define sd second
  36. #define mk make_pair
  37. inline void SetIO(string Name)
  38. {
  39. string Input = Name+".in",
  40. Output = Name+".out";
  41. freopen(Input.c_str(), "r", stdin),
  42. freopen(Output.c_str(), "w", stdout);
  43. }
  44.  
  45. inline int Getint()
  46. {
  47. int Ret = ;
  48. char Ch = ' ';
  49. bool Flag = ;
  50. while(!(Ch >= '' && Ch <= ''))
  51. {
  52. if(Ch == '-') Flag ^= ;
  53. Ch = getchar();
  54. }
  55. while(Ch >= '' && Ch <= '')
  56. {
  57. Ret = Ret * + Ch - '';
  58. Ch = getchar();
  59. }
  60. return Flag ? -Ret : Ret;
  61. }
  62.  
  63. const DB Pi = acos(-1.0), R = 6400.0;
  64. DB Latitude, Longitude, Length;
  65.  
  66. inline void Input()
  67. {
  68. cin >> Latitude >> Longitude >> Length;
  69. }
  70.  
  71. inline void Solve()
  72. {
  73. DB Delta =
  74. Length / (R * cos(Latitude / * Pi+ Length / R)) -
  75. Length / (R * cos(Latitude / * Pi));
  76. Delta = Delta / ( * Pi) * ;
  77. Longitude += Delta;
  78. while(Longitude > 180.0) Longitude -= 360.0;
  79. while(Longitude <= -180.0) Longitude += 360.0;
  80. printf("%.3lf\n%.3lf\n", Latitude, Longitude);
  81. }
  82.  
  83. int main()
  84. {
  85. #ifndef ONLINE_JUDGE
  86. SetIO("D");
  87. #endif
  88. Input();
  89. Solve();
  90. return ;
  91. }

ural 1341. Device的更多相关文章

  1. URAL - 1900 Brainwashing Device

    While some people travel in space from planet to planet and discover new worlds, the others who live ...

  2. ural 2062 Ambitious Experiment

    2062. Ambitious Experiment Time limit: 3.0 secondMemory limit: 128 MB During several decades, scient ...

  3. Linux系统中的Device Mapper学习

    在linux系统中你使用一些命令时(例如nmon.iostat 如下截图所示),有可能会看到一些名字为dm-xx的设备,那么这些设备到底是什么设备呢,跟磁盘有什么关系呢?以前不了解的时候,我也很纳闷. ...

  4. Eclipse调试Android App若选择“Use same device for future launches”就再也无法选择其他设备的问题

    在狂批了某供应商的多媒体控制App有多烂后,夸下海口自己要做一个也是分分钟的事.当然要做好不容易,要超过他们的烂软件还是有信心的.过程中遇到各种坑,其中之一如下 刚开始只使用一个平板进行调试,老是弹出 ...

  5. 设备模型(device-model)之平台总线(bus),驱动(driver),设备(device)

    关于关于驱动设备模型相关概念请参考<Linux Device Drivers>等相关书籍,和内核源码目录...\Documentation\driver-model 简单来说总线(bus) ...

  6. xamarin.forms uwp app部署到手机移动设备进行测试,真机调试(device portal方式部署)

    最近学习xamarin.刚好 手上有一个lumia 930.所以试一试把uwp app部署到手机上,并真机调试一把. 目前环境: 1.开发pc电脑是win10,版本1607.加入了insider,所以 ...

  7. STM32用JLINK 烧写程序时出现NO Cortex-m device found in JTAG chain现象和解决方案

    现象 CPU: STM32107VC 用JLINK 烧写程序时出现NO Cortex-m device found in JTAG chain 如图无法查找到硬件就是CPU 提示1:NO Cortex ...

  8. “(null)” is of a model that is not supported by this version of Xcode. Please use a different device.

    ios    真机运行程序就弹出这个"(null)" is of a model that is not supported by this version of Xcode. P ...

  9. Device Tree(二):基本概念

    转自:http://www.wowotech.net/linux_kenrel/dt_basic_concept.html 一.前言 一些背景知识(例如:为何要引入Device Tree,这个机制是用 ...

随机推荐

  1. 安装less

    1.下载安装iterm(http://www.iterm2.com/) 2.打开iterm,输入 sudo npm install -g less

  2. JavaScript基础——实现循环

    循环是多次执行同一段代码的一种手段.当你需要在一个数组或对象集上重复执行相同的任务时,这是非常有用的. JavaScript提供执行for和while循环的功能. 1.while循环 JavaScri ...

  3. ViewPager部分源码分析二:FragmentManager对Fragment状态的管理完成ViewPager的child添加或移出

    ViewPager维护child代码流程: 注:PagerAdapter 使用的是FragmentPagerAdapter类或者它的子类. viewPager.populate(): void pop ...

  4. Python无类再理解--metaclass,type

    上次理解过一次,时间久了,就忘了.. 再学习一次.. http://blog.jobbole.com/21351/ ======================= 但是,Python中的类还远不止如此 ...

  5. ThinkPHP中getField( )和field( )

    做数据库查询的时候,比较经常用到这两个,总是查手册,记不住,现在把它总结下,希望以后用的时候不查手册了. 不管是用select 查询数据集,还是用find 查询数据,常配合连贯操作where.fiel ...

  6. WPF PRISM开发入门一( 初始化PRISM WPF程序)

    这篇博客将介绍在WPF项目中引入PRISM框架进行开发的一些基础知识.目前最新的PRISM的版本是Prism 6.1.0,可以在Github上获取PRISM的源码.这个系列的博客将选择PRISM 4. ...

  7. SQLite密码添加移除

    背景:电脑清理--个人洁癖 SQLite的最原始的是没有加密的,从而衍生了多种加密算法,但在平常使用中使用System.Data.Sqlite,但其加密后,一般都需要要单独的sqlite管理器--像我 ...

  8. VS2010下配置OpenMesh

    从www.openmesh.org下载最新版的安装包或者源代码,注意下载与自己系统匹配的版本,我下的是VS2010预编译版的,下载源码自己编译是一样的.安装好Visual Studio. 安装Open ...

  9. 在Salesforce中避免对Trigger中Update的无限循环操作

    在Salesforce中避免对Trigger中Update的无限循环操作: 处理Trigger的时候会有这么一个场景:在Trigger中想修改该Object的某些字段的值,那么如果们在程序中再用代码的 ...

  10. How to use Ajax on Visualforce page on Salesforce platform

    Just use Ajax pattern to call object data from server on visualforce page. Following is the Asynchro ...