题目如下:

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. 编译mysql时CMake Error at cmake/readline.cmake:85 (MESSAGE)

    CMake Error at cmake/readline.cmake:85 (MESSAGE):  Curses library not found.  Please install appropr ...

  2. Windows命令集锦

    1.用于私网的IP地址段: 10.0.0.0/8: 10.0.0.0-10.255.255.255 172.16.0.0/12: 172.16.0.0-172.31.255.255 192.168.0 ...

  3. Application.CreateForm()和TForm.Create()创建的窗体有什么区别么?二者在使用上各有什么技巧?(50分)

    https://wedelphi.com/t/135849/ 请详细些,并给出例子.谢谢. Application.CreateForm()创建的第一个可显示的窗体是自动成为主窗体,并且自动显示,并且 ...

  4. html script生成二维码

    <div class="code" align="center"> <p >手机端扫描以下二维码直接观看(支持安卓Android/苹果i ...

  5. java四舍五入及注意点

    package com.example.newtest.test; import java.math.BigDecimal; import java.math.RoundingMode; import ...

  6. FreeMarker开发-数据模型

    FreeMarker用于处理模板的数据模型是哈希表,也就是一个树状结构的name-value对.如下: (root)|+- string="string"| +- map| || ...

  7. Linux window 安装tomcat各版本下载地址

    1.地址 https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/

  8. call 和 apply的定义和区别?

    1.方法定义 call方法: 语法:call([thisObj[,arg1[, arg2[,   [,.argN]]]]]) 定义:调用一个对象的一个方法,以另一个对象替换当前对象. 说明: call ...

  9. JDK11 | 第六篇 : Epsilon 垃圾收集器

    文章首发于公众号<程序员果果> 地址 : https://mp.weixin.qq.com/s/RhGXJImhp7Xm-wDrpPomkQ 一.简介 Epsilon(A No-Op Ga ...

  10. I - The Values You Can Make (背包求具体方案)

    题目大意 给你n个数,让你用这n个数在组成k的情况下,找到所有的value,这些value也由这n个数组成,且这些value组合在一起能够组成k 解法 看到题目我的想法就是母函数= =不过wa了,后来 ...