1 条题解

  • 0
    @ 2022-11-23 17:18:41
    #include
    using namespace std;
    #define ll long long
    int read()//快读 
    {
    	int x=0,f=1;
    	char c=getchar();
    	while(c<'0'||c>'9'){
    		if(c=='-') f=-1;
    		c=getchar();
    	}
    	while('0'<=c&&c<='9'){
    		x=(x<<3)+(x<<1)+c-'0';
    		c=getchar();
    	}
    	return x*f;
    }
    const int MAXN=43200+100;
    int n;
    int tot=43200;
    struct node{
    	double a,b,c;//时分 时秒 分秒 角度 
    }f[MAXN];
    double putin(){
    	int x=read(),y=read();
    	return (double)x/(double)y;
    }
    void sol1(double &x){//维护0-2pi 
    	if(x>=360) x-=360;
    }
    void sol2(double &x){//维护0-pi 
    	if(x>180) x=360-x;
    }
    void pre(){
    	double a,b,c;//时分秒与(12)的角度(0-2pi) 
    	double k=360.0/43200.0;
    	for(int i=1;i<tot;i++){
    		a+=k;//每秒 k度 
    		b+=0.1;//每秒0.1° =360/3600
    		c+=6;//每秒6°=360/60
    		sol1(a);sol1(b);sol1(c);
    		f[i].a=abs(a-b);
    		f[i].b=abs(a-c);
    		f[i].c=abs(b-c);
    		sol2(f[i].a);sol2(f[i].b);sol2(f[i].c);
    	}
    }
    void putout(int x){
    	int h=x/3600,m=(x/60)%60,s=x%60;
    	if(h<10) printf("0");
    	printf("%d:",h);
    	if(m<10) printf("0");
    	printf("%d:",m);
    	if(s<10) printf("0");
    	printf("%d\n",s);
    }
    int ans[100];
    int main()
    {
    	n=read();
    	pre();
    	while(n--){
    		int cnt=0;
    		double a=putin(),b=putin(),c=putin();//时分 时秒 分秒 角度 
    		for(int i=0;i<tot;i++){
    			if(abs(f[i].a-a)<=0.00001&&abs(f[i].b-b)<=0.00001&&abs(f[i].c-c)<=0.00001){
    				ans[cnt++]=i;
    			}
    		}
    		printf("%d\n",cnt);
    		for(int i=0;i<cnt;i++){
    			putout(ans[i]);
    		}
    	}
    	return 0;
    }
    /*
    5
    0/1 0/1 0/1
    90/1 90/1 0/1
    60/1 60/1 60/1
    55/2 5/2 30/1
    45/1 135/1 180/1
    
    */
    

    信息

    ID
    786
    时间
    1000ms
    内存
    256MiB
    难度
    7
    标签
    (无)
    递交数
    54
    已通过
    13
    上传者