题目如下:

Consider  and  to be two points on a 2D plane.

  • happens to equal the minimum value in Northern Latitude (LAT_N in STATION).
  • happens to equal the minimum value in Western Longitude (LONG_W in STATION).
  • happens to equal the maximum value in Northern Latitude (LAT_N in STATION).
  • happens to equal the maximum value in Western Longitude (LONG_W in STATION).

Query the Manhattan Distance between points  and  and round it to a scale of  decimal places.

Input Format

The STATION table is described as follows:

where LAT_N is the northern latitude and LONG_W is the western longitude.

解题思路:用max,abs,min,format即可得到答案。

代码如下:

/*
Enter your query here.
*/
select FORMAT(ABS(a-c) + ABS(b-d),4) from
(select min(LAT_N) as a, min(LONG_W) as b,max(LAT_N) as c, max(LONG_W) as d from STATION) STA;

【hackerrank】Weather Observation Station 18的更多相关文章

  1. 【HackerRank】Bus Station

    有n组好朋友在公交车站前排队.第i组有ai个人.还有一辆公交车在路线上行驶.公交车的容量大小为x,即它可以同时运载x个人. 当车站来车时(车总是空载过来),一些组从会队头开始走向公交车. 当然,同一组 ...

  2. 【LeetCode】134.Gas Station

    Problem: There are N gas stations along a circular route, where the amount of gas at station i is ga ...

  3. 【Java】 剑指offer(18) 删除链表中重复的结点

    本文参考自<剑指offer>一书,代码采用Java语言. 更多:<剑指Offer>Java实现合集   题目 在一个排序的链表中,如何删除重复的结点?例如,在图3.4(a)中重 ...

  4. 【HackerRank】How Many Substrings?

    https://www.hackerrank.com/challenges/how-many-substrings/problem 题解 似乎是被毒瘤澜澜放弃做T3的一道题(因为ASDFZ有很多人做过 ...

  5. 【HackerRank】Running Time of Quicksort

    题目链接:Running Time of Quicksort Challenge In practice, how much faster is Quicksort (in-place) than I ...

  6. 【英文】Bingo口语笔记(18) - Cover系列

    cover charge 服务费 cover version 翻唱版本 cover the news 头条新闻

  7. 【hackerrank】Week of Code 30

    Candy Replenishing Robot Find the Minimum Number 直接模拟 Melodious password dfs输出方案 Poles 题意:有多个仓库,只能从后 ...

  8. 【hackerrank】Week of Code 26

    在jxzz上发现的一个做题网站,每周都有训练题,题目质量……前三题比较水,后面好神啊,而且类型差不多,这周似乎是计数专题…… Army Game 然后给出n*m,问需要多少个小红点能全部占领 解法:乘 ...

  9. 【HackerRank】Median

    题目链接:Median 做了整整一天T_T 尝试了各种方法: 首先看了解答,可以用multiset,但是发现java不支持: 然后想起来用堆,这个基本思想其实很巧妙的,就是维护一个最大堆和最小堆,最大 ...

随机推荐

  1. nginx创建默认虚拟主机

    创建默认虚拟主机配置文件作用:禁止任何人通过ip或未允许的域名访问web服务. 如:vim vhosts/default.conf server { listen 80 default; server ...

  2. 2018.03.26 Python-Pandas 字符串常用方法

    import numpy as np import pandas as pd 1 #字符串常用方法 - strip s = pd.Series([' jack ','jill',' jease ',' ...

  3. Ubuntu vimrc 和 bashrc 配置

    先上效果图,把vimrc 和bashrc 备份一下.. vimrc: map <F9> :call SaveInputData()<CR> func! SaveInputDat ...

  4. linux 学习笔记一

    Linux 学习笔记一 计算机 主要分为五个部分:控制器,运算器,存储器,输入设备,输出设备. 操作系统 操作系统就是针对硬件编写的程序,同时提供硬件接口调用的接口.操作系统需要处理如管理与配置内存. ...

  5. CSS3——表单 计数器 网页布局 应用实例

    CSS应用实例 表单 实例 输入框样式 输入框填充-----内边距 输入框------边框 输入框-----颜色 输入框-----聚焦 输入框-------图标 输入框------动画 [自动右滑] ...

  6. 关于win10系统如何调用debug查看CPU汇编指令和内存

    下载安装DOSBox.网上提供下载地址:DOSBOX Debug是DOS(Disk Operating System,磁盘操作系统).windows提供的实模式(8086方式)程序的调试工具.使用它, ...

  7. Linux 系统安装 python

    Centos 7 Centos 7 安装 python3 (不要卸载python2 因为yum 要用) https://phoenixnap.com/kb/how-to-install-python- ...

  8. Eclipse."Courier New"字体

    1.Win 7 下eclipse添加Courier New字体 - 彦帅的博客.html(https://blog.csdn.net/theblackbeard/article/details/525 ...

  9. python+selenium模拟键盘输入

    from selenium.webdriver.common.keys import Keys #键盘导入类 --------------------------------------------- ...

  10. Linux系统常用命令之top

    top - 06:58:37 up 7 days, 23:36, 2 users, load average: 0.00, 0.01, 0.05Tasks: 716 total, 1 running, ...