zoukankan      html  css  js  c++  java
  • 奶酪

    #include<cstdio>
    #include<cstring>
    #include<iostream>
    #include<algorithm>
    using namespace std;
    inline int read(){
    	int x=0,f=1;
    	char ch=getchar();
    	while(ch>'9'||ch<'0'){
    		if(ch=='-') f=-1;
    		ch=getchar();
    	}
    	while(ch<='9'&&ch>='0'){
    		x=(x<<1)+(x<<3)+(ch^48);
    		ch=getchar();
    	}
    	return x*f;
    }
    
    unsigned long long r,n,h,jud;//定义在最前面,很多函数都要用到
    unsigned long long m[1001];//上文提到过的用来记录该洞是否走过的数组
    
    struct dong {
        double x,y,z;
    }p[1001];
    
    bool pd(dong a,dong b) {//距离公式 
        long long d;
        d=(a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)+(a.z-b.z)*(a.z-b.z);
        if(d<=4*r*r) return true;
        else return false;
    }
    
    void run(int x) {
        if(jud==1) return;
        if(p[x].z+r>=h) {
            jud=1;
            return;
        }
        for(int i=1; i<=n; i++) {
            if(m[i]==1) continue;
            if(pd(p[x],p[i])) {
                m[i]=1;
                run(i);
            }
        }
    }
    
    int main() {
        int t;
        t=read();
        for(int j=1; j<=t; j++) {
          n=read(),h=read(),r=read();
            jud=0;
            for(int i=1; i<=n; i++) m[i]=0;
            for(int i=1; i<=n; i++)
            scanf("%lf%lf%lf",&p[i].x,&p[i].y,&p[i].z);//输入坐标
            for(int i=1; i<=n; i++)
            if(p[i].z<=r) {//判断是不是底边洞
                    m[i]=1;
                    run(i);
                }
            if(jud==1) printf("Yes
    ");
            else printf("No
    ");
        }
        return 0;
    }
    
  • 相关阅读:
    Anaconda 安装tensorflow(GPU)
    冲量:momentum
    pytorch学习笔记
    python的新特性
    pytorch
    ubuntu16.04 eclipse+pydev 配置
    ubuntu16.04 源码方法安装tensorflow
    django xadmin查找当前用户所在组
    django filter or 多条件查询
    django后台对某些字段设置颜色
  • 原文地址:https://www.cnblogs.com/scy-fisheep/p/13821575.html
Copyright © 2011-2022 走看看