• <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 閱讀(1360) 評論(0)  編輯 收藏 引用 所屬分類: ACM

            狼狼综合久久久久综合网| 一本大道久久东京热无码AV| 久久久久亚洲av成人网人人软件| 久久精品极品盛宴观看| 久久99精品久久久久久动态图| 久久亚洲AV无码精品色午夜麻豆| 久久综合色老色| 99久久人妻无码精品系列| 国内精品久久久久久不卡影院| 亚洲精品综合久久| 97久久综合精品久久久综合| 久久这里只有精品视频99| 久久午夜无码鲁丝片| 日本欧美国产精品第一页久久| 少妇熟女久久综合网色欲| 国产精品免费久久久久久久久| 亚洲人成无码www久久久| 亚洲精品tv久久久久久久久| 久久久久噜噜噜亚洲熟女综合 | 久久久国产一区二区三区| 狠狠综合久久AV一区二区三区| 日韩精品久久久久久| 伊人久久大香线焦AV综合影院| 久久久无码精品午夜| 久久精品国产只有精品2020| 97久久婷婷五月综合色d啪蜜芽| 久久精品无码av| 91精品国产综合久久香蕉 | AV色综合久久天堂AV色综合在| 午夜精品久久久久久| 精品无码人妻久久久久久| 91久久精品国产91性色也| 精品久久久久中文字幕日本| 久久久一本精品99久久精品88| 伊人久久综合无码成人网| 狠狠综合久久AV一区二区三区| 欧美精品九九99久久在观看| 亚洲国产精品狼友中文久久久| 久久亚洲高清综合| 亚洲精品97久久中文字幕无码| 久久久久无码精品|