poj 1263 反射問題

2021-05-26 02:36:09 字數 3696 閱讀 7166

//題意:一條射線在n個圓間反射,求依次經過哪些圓。

//用了一些自己寫的簡單的函式,這道題要注意第11個圓也得判斷。

#include

#include

#include

#include

using namespacestd;

constdoubleep=1e-8;

constdoubleinf=1e9;

structpoint;

structcirclesp[26];

structline;

structrayray1,ray2;

doubledist(point p1,point p2)

doubledot_mult(point sp,point ep,point op)

line makeline(point p1,point p2)

t1.b=sign*(p1.x-p2.x);

t1.c=sign*(p1.y*p2.x-p1.x*p2.y);

returnt1;

}

doubledist(point p1,ray ray)

doubledist(ray ray,circle cir)

point vert_p(point p1,line l1)

point sym_p(point sp,point op)

point sym_line(point p1,line l1)

intmain()

}

if(t==-1)

if(sum==10)break;

sum++;tt=t;

ray2.s.x=ray1.s.x+d/sqrt(dist(ray1.s,ray1.e))*(ray1.e.x-ray1.s.x);

ray2.s.y=ray1.s.y+d/sqrt(dist(ray1.s,ray1.e))*(ray1.e.y-ray1.s.y);

ray2.e=sym_line(ray1.s,makeline(sp[t].c,ray2.s));

printf("%d ",t+1);

ray1=ray2;

}

if(t!=-1)

printf(".../n/n");

}

return0;

}

POJ 1263 簡單幾何?!

include include include include include include using namespace std const double dinf 1e100 struct point typedef point vector typedef vectorpolygon ve...

反射問題彙總

本文用來總結.net反射機制中的常見問題,不求甚解,只為解決問題。1 gettype 方法返回null 要先得到程式集,再用程式集的的gettype 方法 type t1 type.gettype sklibrary.skcommand.openledcommand t1為nullassembly ...

反射效率問題

反射帶來了程式設計的靈活性,但是他的執行效率相比於常規呼叫要低。禁用安全檢查可以稍微緩解 所以最好是在必須得用反射的情況下再用反射。以如下 為例,通過兩種方式呼叫某個方法 1000000000l次 privatestaticvoidtest1 privatestaticvoidtest2 throw...