313 条题解

  • 1

    #include<iostream>
    #include<math.h>

    using namespace std;
    const int N=100;
    const double PI=3.1415926;

    int main()
    {
    int n;
    double r;
    double x_arr[N],y_arr[N];
    cin>>n>>r;
    for(int i=0;i<n;i++)
    {
    cin>>x_arr[i]>>y_arr[i];
    }
    double len=0;
    for(int i=0;i<n-1;i++)
    {
    len=len+sqrt((x_arr[i]-x_arr[i+1])*(x_arr[i]-x_arr[i+1])+(y_arr[i]-y_arr[i+1])*(y_arr[i]-y_arr[i+1]));
    }
    len=len+sqrt((x_arr[0]-x_arr[n-1])*(x_arr[0]-x_arr[n-1])+(y_arr[0]-y_arr[n-1])*(y_arr[0]-y_arr[n-1])) ;
    len=len+2*PI*r;

    printf("%.2f\n",len);

    return 0;
    }

  • 1

    #include<iostream>
    #include<math.h>

    using namespace std;
    const int N=100;
    const double PI=3.1415926;

    int main()
    {
    int n;
    double r;
    double x_arr[N],y_arr[N];
    cin>>n>>r;
    for(int i=0;i<n;i++)
    {
    cin>>x_arr[i]>>y_arr[i];
    }
    double len=0;
    for(int i=0;i<n-1;i++)
    {
    len=len+sqrt((x_arr[i]-x_arr[i+1])*(x_arr[i]-x_arr[i+1])+(y_arr[i]-y_arr[i+1])*(y_arr[i]-y_arr[i+1]));
    }
    len=len+sqrt((x_arr[0]-x_arr[n-1])*(x_arr[0]-x_arr[n-1])+(y_arr[0]-y_arr[n-1])*(y_arr[0]-y_arr[n-1])) ;
    len=len+2*PI*r;

    printf("%.2f\n",len);

    return 0;
    }

  • 1
    @ 2021-03-15 13:19:40
    #include <cmath>
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <algorithm>
    #include <vector>
    #include <deque>
    using namespace std;
    
    namespace dts
    {
        const double pi=3.14159265359;
        
        class pnt{
        public:
            double x,y;
        };
        
        int n;
        double R,ans;
        vector<pnt> p;
        
        void main()
        {
            scanf("%d%lf",&n,&R);
            p.resize(n);
            for (int i=0;i<n;i++)
                scanf("%lf%lf",&p[i].x,&p[i].y);
            ans=0;
            for (int i=1;i<n;i++)
            {
                double x=p[i].x-p[i-1].x,y=p[i].y-p[i-1].y;
                ans+=sqrt(x*x+y*y);
            }
            if (n>1)
            {
                double x=p[0].x-p[n-1].x,y=p[0].y-p[n-1].y;
                ans+=sqrt(x*x+y*y);
            }
            ans+=2*pi*R;
            printf("%.2lf\n",ans);
        }
    };
    
    int main()
    {
        dts::main();
    }
    
  • 1
    @ 2017-10-30 21:15:46

    var i,j,n,l:longint;
    x,y,z,xx,yy,r:extended;
    a,b:array[0..1000] of extended;
    begin
    readln(n,r);
    for i:=1 to n do
    readln(a[i],b[i]);
    for i:=1 to n-1 do
    begin
    xx:=(a[i]-a[i+1]);
    yy:=(b[i]-b[i+1]);
    x:=sqrt(xx*xx+yy*yy);
    z:=z+x;
    end;
    z:=z+2*3.1415926535897932384626*r;
    xx:=a[n]-a[1];
    yy:=b[n]-b[1];
    x:=sqrt(xx*xx+yy*yy);
    z:=z+x;
    writeln(z:7:2);
    end.

  • 0
    @ 2020-03-04 16:08:56
    //数学题
    #include <iostream>             //绕钉子的长绳子
    #include <algorithm>
    #include <cmath>
    using namespace std;
    const double Pi = 3.14159;
    const int MaxN = 102;
    
    double R;
    int N;
    
    struct Point {
        double x;
        double y;
    }Poi[MaxN];
    
    double dis(Point a, Point b)
    {
        double x = a.x - b.x;
        double y = a.y - b.y;
        return sqrt(x * x + y * y);
    }
    
    double C()
    {
        double circle = 2 * Pi * R;
        double side = 0;
        side += dis(Poi[0], Poi[N - 1]);
        for (int i = 1; i < N; i++)
            side += dis(Poi[i], Poi[i - 1]);
        return side + circle;
    }
    
    int main()
    {
        cin >> N >> R;
        for (int i = 0; i < N; i++)
            cin >> Poi[i].x >> Poi[i].y;
    
        printf("%.2f\n", C());
    
        system("pause");
        return 0;
    }
    
  • 0
    @ 2019-05-12 15:31:36

    #include<bits/stdc++.h>
    using namespace std;
    const int N=100;
    struct node{
    float x,y;
    }No[N];
    float cal_dis(node x1, node x2)
    {
    return sqrt((x2.x-x1.x)*(x2.x-x1.x)+(x2.y-x1.y)*(x2.y-x1.y));
    }
    int main()
    {
    int N;
    float R;
    float c=0;
    cin>>N>>R;
    for(int i=0;i<N;i++)
    scanf("%f%f",&No[i].x,&No[i].y);
    for(int i=0;i<N;i++)
    {
    c=c+cal_dis(No[i%N],No[(i+1)%N]);
    }
    printf("%.2f\n",2*3.1415926*R+c);
    return 0;
    }

  • 0
    @ 2018-09-19 20:29:29

    python
    ```
    import math

    n,r=map(float,input().split( ))
    list=[]
    n=int(n)
    for i in range(n):
    list.append(input())
    s=2*r*math.pi
    for i in range(1,n):
    x,y= map(float, list[i].split())
    x1,y1=map(float,list[i-1].split())
    s+=math.sqrt(math.pow(x-x1,2)+math.pow(y-y1,2))
    x,y= map(float, list[n-1].split())
    x1,y1=map(float,list[0].split())
    s+=math.sqrt(math.pow(x-x1,2)+math.pow(y-y1,2))
    print("%.2f"%s)
    ```

  • 0
    @ 2018-06-09 18:04:09

    #1 Accepted 2ms 256.0 KiB
    #2 Accepted 2ms 256.0 KiB
    #3 Accepted 2ms 256.0 KiB
    #4 Accepted 2ms 256.0 KiB
    #5 Accepted 2ms 256.0 KiB
    #6 Accepted 2ms 256.0 KiB
    代码
    #include<stdio.h>
    #include<math.h>
    #define PAI 3.141592657
    int main ()
    {
    int n,i;
    float r;
    scanf("%d %f",&n,&r);
    float a[n],b[n],c=2*r*PAI;
    for(i=0;i<n;i++)
    scanf("%f %f",&a[i],&b[i]);
    for(i=1;i<n;i++)
    c+=sqrt(pow(a[i]-a[i-1],2)+pow(b[i]-b[i-1],2));
    c+=sqrt(pow(a[n-1]-a[0],2)+pow(b[n-1]-b[0],2));
    printf("%.2f",c);
    return 0;
    }

  • 0
    @ 2018-02-13 21:29:05

    其实像sprt(x*x+y*y)这样的式子可以用<cmath>里的hypot函数,写起来更清爽

    #include <cstdio>
    #include <cmath>
    
    using namespace std;
    
    double R, fx, fy;
    int N;
    
    int main()
    {
        scanf("%d%lf", &N, &R);
    
        double ans = 2.0 * M_PI * R;
        scanf("%lf%lf", &fx, &fy);
    
        double lx = fx, ly = fy, cx, cy;
        for (int i = 1; i < N; i++)
        {
            scanf("%lf%lf", &cx, &cy);
            ans += hypot(cx - lx, cy - ly);
            lx = cx;
            ly = cy;
        }
    
        ans += hypot(fx - lx, fy - ly);
    
        printf("%.2f", ans);
        return 0;
    }
    
  • 0
    @ 2018-01-16 20:22:55

    因为绳子逆时针转了一圈又回到原点,所以绳子转过的方向之和为2pi(360°)。

    又因为不在弧上的绳子都是两点间直线。

    因此只要算出所有相邻点距离,再加上转过的弧长2pi×r,就可得绳子总长。

    #include<cstdio>
    #include<iostream>
    #include<cmath>
    using namespace std;
    
    int main(){
        int n;
        double x[10005], y[10005];
        double r, d = 0.0;
        cin >> n >> r;
        for(int i=0; i<n; i++){
            cin >> x[i] >> y[i];
            if(i!=0){
                d += sqrt(pow(x[i]-x[i-1], 2) + pow(y[i]-y[i-1], 2));
            }
        }
        d += sqrt(pow(x[n-1]-x[0], 2) + pow(y[n-1]-y[0], 2));
        d += M_PI * 2.0 * r;
        printf("%.2f", d);
        return 0;
    }
    
  • 0
    @ 2017-10-25 18:24:00

    数学题(。・ˍ・。)

    #include<iostream>
    #include<cstdio>
    #include<cmath>
    using namespace std;
    int main()
    {
        int n,k=1;
        double r,ans=0,zbh[150],zbs[150];
        cin>>n>>r;
        for(int i=1;i<=n;++i)
        cin>>zbh[i]>>zbs[i];
        for(int i=1;i<=n-1;++i)
        {
            k++;
            ans+=sqrt(pow(zbh[k]-zbh[k-1],2)+pow(zbs[k]-zbs[k-1],2));
        }
        ans+=sqrt(pow(zbh[n]-zbh[1],2)+pow(zbs[n]-zbs[1],2));
        ans+=2*r*3.141592653589;
        printf("%0.2lf",ans);
        return 0;
    }
    
    
  • 0
    @ 2017-10-05 18:32:51

    没看见“凸”。。。。。。

    #include <iostream>
    #include <algorithm>
    #include <cmath>
    using namespace std;
    #define For(aHJEfaks, fwbjkWK, AENGIBv) for (int aHJEfaks = fwbjkWK; aHJEfaks <= AENGIBv; ++aHJEfaks)
    #define For2(aHJEfaks, fwbjkWK, AENGIBv) for (auto aHJEfaks = fwbjkWK; aHJEfaks != AENGIBv; ++aHJEfaks)
    int n;
    double r;
    typedef pair<double, double> pa;
    pa po[1000];
    bool r1[1000], r2[1000];
    void pr(double x){
        x *= 100;
        int t = (x + 0.5);
        cout << t / 100 << '.' << t % 100 << endl;
    }
    double di(pa x, pa y){
        return sqrt((x.first - y.first) * (x.first - y.first) + (x.second - y.second) * (x.second - y.second));
    }
    bool o1(pa x, pa y, pa z){
        pa tm1 = make_pair(y.first - x.first, y.second - x.second);
        pa tm2 = make_pair(z.first - y.first, z.second - y.second);
        return (tm1.first * tm2.second - tm1.second * tm2.first) > 0;
    }
    int main(){
        cin >> n >> r;
        For(i, 1, n){
            cin >> po[i].first >> po[i].second;
        }
        sort(po + 1, po + n + 1);
        double ans = 2.0 * 3.1415926535 * r;
        if (n == 1){
            pr(ans);
            return 0;
        }
        if (n == 2){
            ans += 2 * di(po[1], po[2]);
            pr(ans);
            return 0;
        }
        r1[1] = r1[2] = true;
        For(i, 3, n){
            r1[i] = true;
            for (int j = i - 1; j >= 2; --j) {
                if (o1(po[j - 1], po[j], po[i])){
                    break;
                }
                r1[j] = false;
            }
        }
        r2[1] = r2[2] = true;
        For(i, 3, n){
            r2[i] = true;
            for (int j = i - 1; j >= 2; --j) {
                if (!o1(po[j - 1], po[j], po[i])){
                    break;
                }
                r2[j] = false;
            }
        }
        int p = 1;
        For(i, 2, n){
            if (r1[i]){
                ans += di(po[i], po[p]);
                p = i;
            }
        }
        p = 1;
        For(i, 2, n){
            if (r2[i]){
                ans += di(po[i], po[p]);
                p = i;
            }
        }
        pr(ans);
        return 0;
    
    }
    /*
    
     5 0
     0 0
     1 -3
     3 -4
     4 -3
     5 -7
    
    
    
    
     */
    
  • 0
    @ 2017-08-20 01:11:29

    正解!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    #include <iostream>
    #include <cstdio>
    #include <cstdlib>
    #include <cmath>
    #include <cstring>
    #include <algorithm>
    using namespace std;
    int main()
    {
        double a[110][3],r,all=0,l;
        long long i,n;
        scanf("%d %lf",&n,&r);
        scanf("%lf %lf",&a[1][1],&a[1][2]);
        for(i=2;i<=n;i++)
        {
            scanf("%lf %lf",&a[i][1],&a[i][2]);
            all=all+sqrt((a[i][1]-a[i-1][1])*(a[i][1]-a[i-1][1])+(a[i][2]-a[i-1][2])*(a[i][2]-a[i-1][2]));
        }
        l=n-2;
        all=all+sqrt((a[1][1]-a[n][1])*(a[1][1]-a[n][1])+(a[1][2]-a[n][2])*(a[1][2]-a[n][2]));
        printf("%.2lf",all+r*2*3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778185778053217122680661300192787661119590921642019893809525720106548586327886593615338182796823030195203530185296899577362259941389124972177528347913151557485724245415069595082953311686172785588907509838175463746493931925506040092770167113900984882401285836160356370766010471018194295559619894676783744944825537977472684710404753464620804668425906949129331367702898915210475216205696602405803815019351125338243003558764024749647326391419927260426992279678235478163600934172164121992458631503028618297455570674983850549458858692699569092721079750930295532116534498720275596023648066549911988183479775356636980742654252786255181841757467289097777279380008164706001614524919217321721477235014144197356854816136115735255213347574184946843852332390739414333454776241686251898356948556209921922218427255025425688767179049460165346680498862723279178608578438382796797668145410095388378636095068006422512520511739298489608412848862694560424196528502221066118630674427862203919494504712371378696095636437191728746776465757396241389086583264599581339047802759009946576407895126946839835259570982582262052248940772671947826848260147699090264013639443745530506820349625245174939965143142980919065925093722169646151570985838741059788595977297549893016175392846813826868386894277415599185592524595395943104997252468084598727364469584865383673622262609912460805124388439045124413654976278079771569143599770012961608944169486855584840635342207222582848864815845602850601684273945226746767889525213852254995466672782398645659611635488623057745649803559363456817432411251507606947945109659609402522887971089314566913686722874894056010150330861792868092087476091782493858900971490967598526136554978189312978482168299894872265880485756401427047755513237964145152374623436454285844479526586782105114135473573952311342716610213596953623144295248493718711014576540359027993440374200731057853906219838744780847848968332144571386875194350643021845319104848100537061468067491927819119793995206141966342875444064374512371819217999839101591956181467514269123974894090718649423196156794520809514655022523160388193014209376213785595663893778708303906979207734672218256259966150142150306803844773454920260541466592520149744285073251866600213243408819071048633173464965145390579626856100550810665879699816357473638405257145910289706414011097120628043903975951567715770042033786993600723055876317635942187312514712053292819182618612586732157919841484882916447060957527069572209175671167229109816909152801735067127485832228718352093539657251210835791513698820914442100675103346711031412671113699086585163983150197016515116851714376576183515565088490998985998238734552833163550764791853589322618548963213293308985706420467525907091548141654985946163718027098199430992448895757128289059232332609729971208443357326548938239119325974636673058360414281388303203824903758985243744170291327656180937734440307074692112019130203303801976211011004492932151608424448596376698389522868478312355265821314495768572624334418930396864262434107732269780280731891544110104468232527162010526522721116603966655730925471105578537634668206531098965269186205647693125705863566201855810072936065987648611791045334885034611365768675324944166803962657978771855608455296541266540853061434443185867697514566140680070023787765913440171274947042056223053899456131407112700040785473326993908145466464588079727082668306343285878569830523580893306575740679545716377525420211495576158140025012622859413021647155097925923099079654737612551765675135751782966645477917450112996148903046399471329621073404375189573596145890193897131117904297828564750320319869151402870808599048010941214722131794764777262241425485454033215718530614228813758504306332175182979866223717215916077166925474873898665494945011465406284336639379003976926567214638530673609657120918076383271664162748888007869256029022847210403172118608204190004229661711963779213375751149595015660496318629472654736425230817703675159067350235072835405670403867435136222247715891504953098444893330963408780769325993978054193414473774418426312986080998886874132604721569516239658645730216315981931951673538129741677294786724229246543668009806769282382806899640048243540370141631496589794092432378969070697794223625082216889573837986230015937764716512289357860158816175578297352334460428151262720373431465319777741603199066554187639792933441952154134189948544473456738316249934191318148092777710386387734317720754565453220777092120190516609628049092636019759882816133231666365286193266863360627356763035447762803504507772355471058595487027908143562401451718062464362679456127531813407833033625423278394497538243720583531147711992606381334677687969597030983391307710987040859133746414428227726346594704745878477872019277152807317679077071572134447306057007334924369311383504931631284042512192565179806941135280131470130478164378851852909285452011658393419656213491434159562586586557055269049652098580338507224264829397285847831630577775606888764462482468579260395352773480304802900587607582510474709164396136267604492562742042083208566119062545433721315359584506877246029016187667952406163425225771954291629919306455377991403734043287526288896399587947572917464263574552540790914513571113694109119393251910760208252026187985318877058429725916778131496990090192116971737278476847268608490033770242429165130050051683233643503895170298939223345172201381280696501178440874519601212285993716231301711444846409038906449544400619869075485160263275052983491874078668088183385102283345085048608250393021332197155184306354550076682829493041377655279397517546139539846833936383047461199665385815384205685338621867252334028308711232827892125077126294632295639898989358211674562701021835646220134967151881909730381198004973407239610368540664319395097901906996395524530054505806855019567302292191393391856803449039820595510022635353619204199474553859381023439554495977837790237421617271117236434354394782218185286240851400666044332588856986705431547069657474585503323233421073015459405165537906866273337995851156257843229882737231989875714159578111963583300594087306812160287649628674460477464915995054973742562690104903778198683593814657412680492564879855614537234786733039046883834363465537949864192705638729317487233208376011230299113679386270894387993620162951541337142489283072201269014754668476535761647737946752004907571555278196536213239264061601363581559074220202031872776052772190055614842555187925303435139844253223415762336106425063904975008656271095359194658975141310348227693062474353632569160781547818115284366795706110861533150445212747392454494542368288606134084148637767009612071512491404302725386076482363414334623518975766452164137679690314950191085759844239198629164219399490723623464684411739403265918404437805133389452574239950829659122850855582157250310712570126683024029295252201187267675622041542051618416348475651699981161410100299607838690929160302884002691041407928862150784245167090870006992821206604183718065355672525325675328612910424877618258297651579598470356222629348600341587229805349896502262917487882027342092222453398562647669149055628425039127577102840279980663658254889264880254566101729670266407655904290994568150652653053718294127033693137851786090407086671149655834343476933857817113864558736781230145876871266034891390);
        return 0;
    }
    
    
    
  • 0
    @ 2016-08-10 11:31:19
    #include <iostream>
    #include <cmath>
    #include <iomanip>
    using namespace std;
    double x[101],y[101],ans=0,r;
    int n;
    int main(){
        ios::sync_with_stdio(false);
        cin >> n >> r;
        cin >> x[1] >> y[1];
        for (int i=2;i<=n;i++){
            cin >> x[i] >> y[i];
            ans+=sqrt((x[i]-x[i-1])*(x[i]-x[i-1])+(y[i]-y[i-1])*(y[i]-y[i-1]));
        }
        ans+=sqrt((x[1]-x[n])*(x[1]-x[n])+(y[1]-y[n])*(y[1]-y[n]));
        cout << setiosflags(ios::fixed)<< setprecision(2) << ans+2*r*3.1415926;
    }
    
  • 0
    @ 2016-06-18 09:50:16

    ans=点点距之和+圆周

    #include <iostream>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    using namespace std;
    const float P = 3.1416;
    const int N = 105;
    struct point{
    float x;
    float y;
    point(){x = y = 0.0;};
    double operator - (const point a){
    return (sqrt((x - a.x) * (x - a.x) + (y - a.y) * (y - a.y)));
    }
    }A[N];
    int n;
    float r,len;
    int main(){
    scanf("%d%f",&n,&r);
    for(int i = 0;i < n;i++) scanf("%f%f",&A[i].x,&A[i].y);
    len += (A[0] - A[n - 1]);
    for(int i = 1;i < n;i++) len += (A[i] - A[i - 1]);
    len += (P * r * 2.0);
    printf("%.2f\n",len);
    return 0;
    }

  • 0
    @ 2016-06-18 01:24:10

    #include <stdio.h>
    #include <math.h>

    int main(){
    int n;
    float a[100][2];
    int i;
    float len,distance,r;
    scanf("%d %f",&n,&r);//r must be float
    for(i=0;i<n;i++)
    scanf("%f %f",&a[i][0],&a[i][1]);
    //printf("%f %f",a[0][0],a[0][1]);

    len=sqrt( pow(a[0][0]-a[n-1][0],2)+ pow(a[0][1]-a[n-1][1],2) );
    for(i=0;i<n-1;i++){
    distance=sqrt( pow(a[i][0]-a[i+1][0],2)+ pow(a[i][1]-a[i+1][1],2) );
    len+=distance;
    }

    len+=2*M_PI*r;
    printf("%.2f",len);

    return 0;
    }

  • 0
    @ 2016-05-24 23:12:22

    #include <cstdio>
    #include <cmath>

    float p[100][2];

    float dist(int a,int b){
    float dx=p[a][0]-p[b][0];
    float dy=p[a][1]-p[b][1];
    return sqrt(dx*dx+dy*dy);
    }

    int main(void){
    // freopen("in.txt","r",stdin);
    int n;
    float r,lenth=0.0;
    scanf("%d%f",&n,&r);
    for(int i=0;i<n;i++){
    scanf("%f%f",&p[i][0],&p[i][1]);
    if(i>0)
    lenth+=dist(i-1,i);
    }
    lenth+=dist(0,n-1)+3.1415926*2*r;
    printf("%.2f",lenth);
    return 0;
    }

  • 0
    @ 2016-05-24 12:42:12
    so water!!!!!
    记录信息
    评测状态    Accepted
    题目  P1007 绕钉子的长绳子
    递交时间    2016-05-14 10:52:10
    代码语言    C++
    评测机 ShadowShore
    消耗时间    0 ms
    消耗内存    504 KiB
    评测时间    2016-05-14 10:52:11
    评测结果
    编译成功
    
    测试数据 #0: Accepted, time = 0 ms, mem = 504 KiB, score = 10
    测试数据 #1: Accepted, time = 0 ms, mem = 504 KiB, score = 10
    测试数据 #2: Accepted, time = 0 ms, mem = 504 KiB, score = 10
    测试数据 #3: Accepted, time = 0 ms, mem = 500 KiB, score = 10
    测试数据 #4: Accepted, time = 0 ms, mem = 504 KiB, score = 10
    测试数据 #5: Accepted, time = 0 ms, mem = 500 KiB, score = 10
    Accepted, time = 0 ms, mem = 504 KiB, score = 60
    代码
    #include<cstdio>
    #include<cmath>
    using namespace std;
    int main()
    {
      int n;
      float a[101][3],ans=0,r;
      scanf("%d %f\n",&n,&r);
      for(int i=1;i<=n;i++)
        scanf("%f %f",&a[i][1],&a[i][2]);
      for(int i=1;i<n;i++)
        ans+=sqrt((a[i][1]-a[i+1][1])*(a[i][1]-a[i+1][1])+(a[i][2]-a[i+1][2])*(a[i][2]-a[i+1][2]));
      ans+=sqrt((a[n][1]-a[1][1])*(a[n][1]-a[1][1])+(a[n][2]-a[1][2])*(a[n][2]-a[1][2]));
      printf("%.2f",ans+r*2*3.1415926);
      return 0;
    }
    
  • 0
    @ 2016-04-03 23:10:01
    uses math;
    const pi=3.1415926535897932384626;
    var ans,r,x0,y0,x1,y1,x2,y2:extended;
      n,i:integer;
    begin
      read(n,r);
      read(x1,y1);
      x0:=x1;y0:=y1;
      ans:=0;
      for i:=2 to n do begin
        read(x2,y2);
        ans:=ans+sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
        x1:=x2;
        y1:=y2;
      end;
      ans:=ans+sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0));
      ans:=ans+2*pi*r;
      writeln(ans:7:2);
    end.
    
  • 0
    @ 2016-02-17 20:15:31
    请想一想有没有更简单的方法
    

信息

ID
1007
难度
5
分类
模拟 点击显示
标签
(无)
递交数
12244
已通过
4327
通过率
35%
被复制
26
上传者