2#include3#include4#include5#include6#include78#defineN5209#defineEPS1e-6101" />

欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

BZOJ 1502 月下檸檬樹 simpson積分

系統 1863 0

題解:
投在地上的影子是很多圓和兩圓公切線組成的梯形的面積并。

PS:圓只要和地面平行,無論光從哪個角度照射,投影都是圓

?

其實應該一開始應先分成若干份做simpson的。。

View Code
        
           1
        
         #include <iostream>


        
           2
        
         #include <cstring>


        
           3
        
         #include <cstdio>


        
           4
        
         #include <cstdlib>


        
           5
        
         #include <algorithm>


        
           6
        
         #include <cmath>


        
           7
        
        
           8
        
        
          #define
        
         N 520


        
           9
        
        
          #define
        
         EPS 1e-6


        
          10
        
        
          11
        
        
          using
        
        
          namespace
        
        
           std;


        
        
          12
        
        
          13
        
        
          int
        
        
           n;


        
        
          14
        
        
          double
        
        
           a[N],b[N],af,h,lt,rt;


        
        
          15
        
        
          16
        
        
          struct
        
        
           C


        
        
          17
        
        
          {


        
        
          18
        
        
          double
        
        
           x,y,p,q;


        
        
          19
        
        
          }c[N];


        
        
          20
        
        
          21
        
         inline 
        
          int
        
         dc(
        
          double
        
        
           x)


        
        
          22
        
        
          {


        
        
          23
        
        
          if
        
        (x>EPS) 
        
          return
        
        
          1
        
        
          ;


        
        
          24
        
        
          else
        
        
          if
        
        (x<-EPS) 
        
          return
        
         -
        
          1
        
        
          ;


        
        
          25
        
        
          return
        
        
          0
        
        
          ;


        
        
          26
        
        
          }


        
        
          27
        
        
          28
        
         inline 
        
          void
        
        
           read()


        
        
          29
        
        
          {


        
        
          30
        
             scanf(
        
          "
        
        
          %d%lf
        
        
          "
        
        ,&n,&
        
          af);


        
        
          31
        
             af=
        
          1
        
        /
        
          tan(af);


        
        
          32
        
        
          for
        
        (
        
          int
        
         i=
        
          1
        
        ;i<=n+
        
          1
        
        ;i++
        
          )


        
        
          33
        
        
              {


        
        
          34
        
                 scanf(
        
          "
        
        
          %lf
        
        
          "
        
        ,&
        
          a[i]);


        
        
          35
        
                 h+=a[i]; a[i]=h*
        
          af;


        
        
          36
        
        
              }


        
        
          37
        
             lt=a[
        
          1
        
        ];rt=a[n+
        
          1
        
        
          ];


        
        
          38
        
        
          for
        
        (
        
          int
        
         i=
        
          1
        
        ;i<=n;i++
        
          )


        
        
          39
        
        
              {


        
        
          40
        
                 scanf(
        
          "
        
        
          %lf
        
        
          "
        
        ,&
        
          b[i]);


        
        
          41
        
                 lt=min(lt,a[i]-
        
          b[i]);


        
        
          42
        
                 rt=max(rt,a[i]+
        
          b[i]);


        
        
          43
        
        
              }


        
        
          44
        
        
          }


        
        
          45
        
        
          46
        
         inline 
        
          void
        
        
           calc()


        
        
          47
        
        
          {


        
        
          48
        
        
          for
        
        (
        
          int
        
         i=
        
          1
        
        ;i<=n;i++
        
          )


        
        
          49
        
        
          if
        
        (a[i+
        
          1
        
        ]-a[i]>fabs(b[i+
        
          1
        
        ]-
        
          b[i]))


        
        
          50
        
        
                  {


        
        
          51
        
                     c[i].x=a[i]+b[i]*(b[i]-b[i+
        
          1
        
        ])/(a[i+
        
          1
        
        ]-
        
          a[i]);


        
        
          52
        
                     c[i].y=sqrt(b[i]*b[i]-(c[i].x-a[i])*(c[i].x-
        
          a[i]));


        
        
          53
        
                     c[i].p=a[i+
        
          1
        
        ]+b[i+
        
          1
        
        ]*(b[i]-b[i+
        
          1
        
        ])/(a[i+
        
          1
        
        ]-
        
          a[i]);


        
        
          54
        
                     c[i].q=sqrt(b[i+
        
          1
        
        ]*b[i+
        
          1
        
        ]-(c[i].p-a[i+
        
          1
        
        ])*(c[i].p-a[i+
        
          1
        
        
          ]));


        
        
          55
        
        
                  }


        
        
          56
        
        
          }


        
        
          57
        
        
          58
        
         inline 
        
          double
        
         f(
        
          double
        
        
           p)


        
        
          59
        
        
          {


        
        
          60
        
        
          double
        
         res=
        
          0
        
        
          ;


        
        
          61
        
        
          for
        
        (
        
          int
        
         i=
        
          1
        
        ;i<=n;i++
        
          )


        
        
          62
        
        
              {


        
        
          63
        
        
          if
        
        (fabs(a[i]-p)<b[i]) res=max(res,sqrt(b[i]*b[i]-(a[i]-p)*(a[i]-
        
          p)));


        
        
          64
        
        
          if
        
        (p>c[i].x&&p<c[i].p) res=max(res,c[i].y-(p-c[i].x)*(c[i].y-c[i].q)/(c[i].p-
        
          c[i].x));


        
        
          65
        
        
              }


        
        
          66
        
        
          return
        
        
           res;


        
        
          67
        
        
          }


        
        
          68
        
        
          69
        
         inline 
        
          double
        
         simpson(
        
          double
        
         l,
        
          double
        
         r,
        
          double
        
         fl,
        
          double
        
         fmid,
        
          double
        
        
           fr)


        
        
          70
        
        
          {


        
        
          71
        
        
          return
        
         (fl+fr+
        
          4
        
        *fmid)*(r-l)/
        
          6
        
        
          ;


        
        
          72
        
        
          }


        
        
          73
        
        
          74
        
         inline 
        
          double
        
         rsimpson(
        
          double
        
         l,
        
          double
        
         r,
        
          double
        
         fl,
        
          double
        
         fmid,
        
          double
        
        
           fr)


        
        
          75
        
        
          {


        
        
          76
        
        
          double
        
        
           p,q,mid,x,y,z;


        
        
          77
        
             mid=(l+r)/
        
          2
        
        
          ;


        
        
          78
        
             p=f((l+mid)/
        
          2
        
        ); q=f((mid+r)/
        
          2
        
        
          );


        
        
          79
        
             x=simpson(l,r,fl,fmid,fr); y=simpson(l,mid,fl,p,fmid); z=
        
          simpson(mid,r,fmid,q,fr);


        
        
          80
        
        
          if
        
        (dc(fabs(x-y-z))==
        
          0
        
        ) 
        
          return
        
         y+
        
          z;


        
        
          81
        
        
          else
        
        
          return
        
         rsimpson(l,mid,fl,p,fmid)+
        
          rsimpson(mid,r,fmid,q,fr);


        
        
          82
        
        
          }


        
        
          83
        
        
          84
        
         inline 
        
          void
        
        
           go()


        
        
          85
        
        
          {


        
        
          86
        
        
              calc();


        
        
          87
        
             printf(
        
          "
        
        
          %.2lf\n
        
        
          "
        
        ,
        
          2
        
        *rsimpson(lt,rt,
        
          0
        
        ,f(lt+rt)/
        
          2
        
        ,
        
          0
        
        
          ));


        
        
          88
        
        
          }


        
        
          89
        
        
          90
        
        
          int
        
        
           main()


        
        
          91
        
        
          {


        
        
          92
        
        
              read(),go();


        
        
          93
        
        
          return
        
        
          0
        
        
          ;


        
        
          94
        
         }
      

?

?

BZOJ 1502 月下檸檬樹 simpson積分


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 久久精品视频99 | 精品久久久中文字幕一区 | 久久国产精品精品国产 | 日本免费观看网站 | 91精品国产免费久久 | 在线不卡一区 | 大毛片 | 老头天天吃我奶躁我午夜视频 | 久青青 | 亚洲一区久欠无码A片 | 欧美高清性色生活片免费观看 | 一级毛片免费 | 草草在线观看 | 国产成人在线播放视频 | 美女求操| 911色_911色sss主站色播 | 欧美精品国产精品 | 无码色情影片视频在线看免费 | 国产精品久久久久影院色老大 | 亚洲欧美一区二区三区综合 | 99久久综合给久久精品 | 国产成人免费永久播放视频平台 | 午夜在线观看免费视频 | 午夜三级影院 | 免费无码毛片一区二区A片 成人18网站 | 欧美成在人线a免费视频 | 亚洲影视在线观看 | 久久久久999 | 天天操天天摸天天爽 | 爽毛片 | 久久久久久网站 | 婷婷六月综合网 | 成年美女黄的视频网站 | 久久华人| 色婷五月综激情亚洲综合 | 九九久久精品 | 麻豆国产精品 | 精品美女在线观看视频在线观看 | 日本高清视频在线播放 | 毛片a级| a在线视频观看 |