• P5600 【XR-4】尺规作图


    P5600 【XR-4】尺规作图

    做了一天的提答题,还是NOIP前冒着生命危险咕掉模拟赛做的。

    NOIP2020 rp++!!!

    不忍心丢掉答案,存一下吧,不会的话自己把点画出来就好了,可以用 GeoGebra ,我就是用这个做的。

    前八个点还是挺有价值的,后面两个做不做随便,就是拿那个软件乱试,没啥意思。

    T1

    3
    1 0 0 1 0
    1 1 0 0 0
    2 0.5 0.866025404 0.5 -0.866025404
    

    T2

    3
    1 1 0 5.23124577 4.31624417
    1 0 0 5.23124577 4.31624417
    2 5.23124577 4.31624417 5.23124577 -4.31624417
    

    T3

    5
    1 0 0 1 0
    1 1 0 0 0
    2 0.5 0.8660254038 0.5 -0.8660254038
    1 0.5 1 0.5 0
    2 -0.4916198487 0.8708099244 0.9916198487 0.1291900756
    
    

    T4

    10
    1 1 0 0 0
    1 2 0 0 0
    1 4 0 0 0
    1 8 0 0 0
    1 16 0 0 0
    1 32 0 0 0
    1 64 0 0 0
    1 128 0 0 0
    1 256 0 0 0
    1 512 0 0 0
    

    T5

    10
    1 1 0 0 0
    1 2 0 0 0
    1 4 0 0 0
    1 0 0 8 0
    1 -8 0 8 0
    1 8 0 -24 0
    1 40 0 -24 0
    1 104 0 -24 0
    1 232 0 -24 0
    1 488 0 -24 0
    

    T6

    27
    2 0 0 0 1
    1 0 1.0000000000 0 0.0000000000
    2 -0.8660254040 0.5000000000 0.8660254040 0.5000000000
    1 0 0.0000000000 0 0.5000000000
    2 -0.4841229187 0.1250000000 0.4841229187 0.1250000000
    1 0 0.5000000000 0 0.1250000000
    2 -0.3476343052 0.3593750000 0.3476343052 0.3593750000
    1 0 0.5000000000 0 0.3593750000
    2 -0.1392276034 0.4802246094 0.1392276034 0.4802246094
    1 0 0.3593750000 0 0.4802246094
    2 -0.1091245016 0.4113025665 0.1091245016 0.4113025665
    1 0 0.4802246094 0 0.4113025665
    2 -0.0660604790 0.4605710581 0.0660604790 0.4605710581
    1 0 0.4113025665 0 0.4605710581
    2 -0.0460139752 0.4289122032 0.0460139752 0.4289122032
    1 0 0.4113025665 0 0.4289122032
    2 -0.0174653775 0.4135522046 0.0174653775 0.4135522046
    1 0 0.4289122032 0 0.4135522046
    2 -0.0138222866 0.4222133268 0.0138222866 0.4222133268
    1 0 0.4222133268 0 0.4135522046
    2 -0.0068365531 0.4275309935 0.0068365531 0.4275309935
    1 0 0.4275309935 0 0.4135522046
    2 -0.0132070592 0.4229504793 0.0132070592 0.4229504793
    1 0 0.4135522046 0 0.4229504793
    2 -0.0078948025 0.4186512879 0.0078948025 0.4186512879
    1 0 0.4229504793 0 0.4186512879
    2 -0.0041853462 0.4219671581 0.0041853462 0.4219671581
    

    code

    #include<bits/stdc++.h>
    using namespace std;
    #define fi first
    #define se second
    #define mkp(x,y) make_pair(x,y)
    #define pb(x) push_back(x)
    #define sz(v) (int)v.size()
    typedef long long LL;
    typedef long double db;
    template<class T>bool ckmax(T&x,T y){return x<y?x=y,1:0;}
    template<class T>bool ckmin(T&x,T y){return x>y?x=y,1:0;}
    #define rep(i,x,y) for(int i=x,i##end=y;i<=i##end;++i)
    #define per(i,x,y) for(int i=x,i##end=y;i>=i##end;--i)
    inline int read(){
    	int x=0,f=1;char ch=getchar();
    	while(!isdigit(ch)){if(ch=='-')f=0;ch=getchar();}
    	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
    	return f?x:-x;
    }
    const db eps=1e-9;
    const db X=0.90660864,Y=0.42197248;
    struct cir{
    	db x,r;
    	cir(){x=r=0;}
    	cir(db x_,db r_){x=x_,r=r_;}
    }c[50];
    db inter_circle(cir a,cir b){
    	if(fabs(a.x-b.x)<eps)return a.x;
    	db cos_=((b.x-a.x)*(b.x-a.x)+a.r*a.r-b.r*b.r)/(2*(b.x-a.x)*a.r);
    	// cerr<<"cir:"<<a.x<<' '<<a.r<<' '<<b.x<<' '<<b.r<<' '<<a.x+a.r*cos_<<'
    ';
    	return a.x+a.r*cos_;
    }
    db Sqrt(db x){
    	db l=0,r=100;
    	while(r-l>eps){
    		db mid=(l+r)/2;
    		if(mid*mid<x+eps)l=mid;
    		else r=mid;
    	}
    	return l;
    }
    signed main(){
    	puts("40");
    	puts("2 0 0 0 1");
    	c[0]=cir(0,1);
    	db l=0,r=1;
    	for(int T=1;T<=19;++T){
    		db mi=114514;pair<int,int>id=mkp(-1,-1);
    		// if(T&1)printf("1 0 %.10Lf 0 %.10Lf
    ",r,l),c[T]=cir(r,r-l);
    		// else printf("1 0 %.10Lf 0 %.10Lf
    ",l,r),c[T]=cir(l,r-l);
    		cir c1=cir(r,r-l),c2=cir(l,r-l);
    		rep(i,0,T-1){
    			db tmp=inter_circle(c1,c[i]);
    			if(fabs(l-tmp)>eps&&fabs(r-tmp)>eps&&ckmin(mi,fabs(Y-tmp)))id=mkp(i,0);
    			tmp=inter_circle(c2,c[i]);
    			if(fabs(l-tmp)>eps&&fabs(r-tmp)>eps&&ckmin(mi,fabs(Y-tmp)))id=mkp(i,1);
    		}
    		c[T]=id.se?c2:c1;
    		db tmp=inter_circle(c[T],c[id.fi]);
    		// cerr<<id.fi<<' '<<id.se<<' '<<tmp<<'
    ';
    		printf("1 0 %.10Lf 0 %.10Lf
    ",c[T].x,l+r-c[T].x);
    		if(tmp<=Y)l=tmp;else r=tmp;
    		db tmp2=Sqrt(c[id.fi].r*c[id.fi].r-(c[id.fi].x-tmp)*(c[id.fi].x-tmp));
    		printf("2 %.10Lf %.10Lf %.10Lf %.10Lf
    ",-tmp2,tmp,tmp2,tmp);
    		if(fabs(tmp-Y)<1e-5)break;
    		// cerr<<"debug:"<<l<<' '<<r<<'
    ';
    	}
    	// rep(i,0,19)cerr<<c[i].x<<' '<<c[i].r<<'
    ';
    }
    

    T7

    5
    1 12.34441574 0.00000000 5.16457145 9.12243565
    1 5.16457145 9.12243565 12.34441574 0.00000000
    2 0 0 16.6547546123 10.7791453754
    1 0.7454403075 0.4824573901 12.34441574 0.00000000
    2 5.16457145 9.12243565 6.1271076677 -9.8037786874
    

    T8

    5
    1 0 0 5.16457145 9.12243565
    1 12.34441574 0.00000000 5.16457145 9.12243565
    1 0.7354107776 0 10.4829208931 0
    1 10.4829208931 0 0.7354107776 0
    2 5.6091658353 8.4415913837 5.6091658353 -8.4415913837
    

    T9

    6
    1 0 0 10.64978745 0.00000000
    1 10.64978745 0.00000000 0 0
    1 -10.64978745 0.00000000 0 0
    1 5.324893725 9.2229864766 21.29957490 0
    2 -2.8891429893 -7.2931728544 -5.324893725 9.2229864766
    1 -3.9647169663 0 -10.64978745 0
    

    T10

    9
    1 0 0 10.64978745 0.00000000
    1 10.64978745 0.00000000 0 0
    1 -10.64978745 0.00000000 0 0
    1 5.324893725 9.2229864766 21.29957490 0
    2 -2.8891429893 -7.2931728544 -5.324893725 9.2229864766
    1 -3.9647169663 0 -10.64978745 0
    2 5.324893725 9.2229864766 -2.1668572419 6.4387784412
    2 21.2995749 0 -13.0855381857 10.3675016799
    1 -6.5503572407 8.3970704861 22.6154412357 15.6487848684
    
  • 相关阅读:
    一文读懂网管协议
    Python 3.8 离线安装
    Redis 6.X 离线安装
    ES 日期格式影响聚合效果
    (1)Canal入门
    (10)MySQL进阶篇SQL优化(InnoDB锁-间隙锁)
    (9)MySQL进阶篇SQL优化(InnoDB锁-记录锁)
    (8)MySQL进阶篇SQL优化(InnoDB锁-共享锁、排他锁与意向锁)
    (7)MySQL进阶篇SQL优化(InnoDB锁-事务隔离级别 )
    (6)MySQL进阶篇SQL优化(MyISAM锁)
  • 原文地址:https://www.cnblogs.com/zzctommy/p/14087709.html
Copyright © 2020-2023  润新知