• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            coreBugZJ

            此 blog 已棄。

            How Long Is it, FZU 2011年3月月賽之 G, FZU 2016

            Problem 2016 How Long Is it

            Time Limit: 1000 mSec    Memory Limit : 32768 KB

            Problem Description

            You are given two points in earth. (Points are described as the latitude (between -90 and +90 degrees) and longitude (between -180 and +180 degrees)) You are expected to calculate the distance between them ( in km). In this problem the radius of earth is 6378 km.

            Input

            In the first line one integer T indicates the number of test cases. (T <= 1000)

            For each case, only two points each giving the latitude (between -90 and +90 degrees) and longitude (between -180 and +180 degrees) .

            Output

            For each test case, output the distance between them, the answer should accurate to 0.01.

            Sample Input

            4
            -90 180 -90 90
            -90 180 -90 90
            -90 0 -90 90
            -90 0 90 90

            Sample Output

            0.00
            0.00
            0.00
            20037.08

            Source

            FOJ有獎月賽-2011年03月

            水題。。。

             1 #include <iostream>
             2 #include <cstdio>
             3 #include <cmath>
             4 
             5 using namespace std;
             6 
             7 const double PI = 3.141592653589793;
             8 const double R = 6378;
             9 
            10 #define  A(x)  ( (x) * PI / 180.0 )
            11 
            12 int main() {
            13         int td, a, b, c, d;
            14         double da, db, dc, dd, px, py, pz, qx, qy, qz, ang, dist;
            15         scanf( "%d"&td );
            16         while ( td-- > 0 ) {
            17                 scanf( "%d%d%d%d"&a, &b, &c, &d );
            18                 da = A(a);
            19                 db = A(b);
            20                 dc = A(c);
            21                 dd = A(d);
            22 
            23                 pz = R * sin( da );
            24                 qz = R * sin( dc );
            25 
            26                 px = R * cos( da ) * cos( db );
            27                 qx = R * cos( dc ) * cos( dd );
            28 
            29                 py = R * cos( da ) * sin( db );
            30                 qy = R * cos( dc ) * sin( dd );
            31 
            32                 ang = acos( (px*qx+py*qy+pz*qz) / 
            33                                 sqrt(px*px+py*py+pz*pz) / 
            34                                 sqrt(qx*qx+qy*qy+qz*qz)    );
            35                 dist = R * ang;
            36 
            37                 printf( "%0.2lf\n", dist );
            38         }
            39         return 0;
            40 }
            41 


            posted on 2011-03-20 20:49 coreBugZJ 閱讀(1355) 評論(0)  編輯 收藏 引用 所屬分類: ACM

            色综合久久久久| 少妇久久久久久久久久| 激情综合色综合久久综合| 久久久WWW免费人成精品| 精品国产乱码久久久久软件| 99国产欧美久久久精品蜜芽| 久久久久亚洲av成人无码电影 | 伊人情人综合成人久久网小说| 精品久久久无码人妻中文字幕| 久久久九九有精品国产| 一本大道久久香蕉成人网| 久久精品嫩草影院| 精品国产99久久久久久麻豆| 一本久久久久久久| 麻豆一区二区99久久久久| 看全色黄大色大片免费久久久 | 伊人久久大香线蕉综合热线| 国内精品九九久久久精品| 日批日出水久久亚洲精品tv| 国产精品久久网| 无码AV波多野结衣久久| 久久丫忘忧草产品| 久久精品国产亚洲精品| 91精品国产91久久久久久青草| 亚洲欧美日韩中文久久| 国产色综合久久无码有码| 久久这里有精品视频| 九九久久精品国产| 亚洲国产精品婷婷久久| 亚洲国产精品久久久久婷婷老年| 久久久久99精品成人片直播| 一本一道久久综合狠狠老| 一本色道久久99一综合| 性做久久久久久久| 精品综合久久久久久888蜜芽| 亚洲AV日韩精品久久久久久| 久久综合国产乱子伦精品免费| av色综合久久天堂av色综合在| 亚洲精品乱码久久久久久按摩 | 99精品国产99久久久久久97| 99久久国产亚洲综合精品|