日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

ZOJ 1696 Viva Confetti 计算几何

發布時間:2025/6/15 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ZOJ 1696 Viva Confetti 计算几何 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.


計算幾何:按順序給n個圓覆蓋。問最后能夠有幾個圓被看見。。

對每一個圓求和其它圓的交點,每兩個交點之間就是可能被看到的圓弧,取圓弧的中點,往外擴展一點或者往里縮一點,從上往下推斷有沒有圓能夠蓋住這個點,能蓋住這個點的最上面的圓一定是可見的


Viva Confetti
Time Limit:?2 Seconds ?????Memory Limit:?65536 KB
Do you know confetti?

They are small discs of colored paper, and people throw them around during parties or festivals. Since people throw lots of confetti, they may end up stacked one on another, so there may be hidden ones underneath.

A handful of various sized confetti have been dropped on a table. Given their positions and sizes, can you tell us how many of them you can see?

The following figure represents the disc configuration for the first sample input, where the bottom disc is still visible.


Input

The input is composed of a number of configurations of the following form.

n
x1 y1 r1
x2 y2 r2
. . .
xn yn rn

The first line in a configuration is the number of discs in the configuration (a positive integer not more than 100), followed by one line descriptions of each disc: coordinates of its center and radius, expressed as real numbers in the decimal notation, with up to 12 digits after the decimal point. The imprecision margin is 5*10^-13. That is, it is guaranteed that variations of less than 5*10^-13 on input values do not change which discs are visible. Coordinates of all points contained in discs are between -10 and 10.

Confetti are listed in their stacking order, x1 y1 r1 being the bottom one and xn yn rn the top one. You are observing from the top.

The end of the input is marked by a zero on a single line.


Output

For each configuration you should output the number of visible confetti on a single line.


Sample Input

3
0 0 0.5
-0.9 0 1.00000000001
0.9 9 1.00000000001
5
0 1 0.5
1 1 1.00000000001
0 2 1.00000000001
-1 1 1.00000000001
0 -0.00001 1.00000000001
5
0 1 0.5
1 1 1.00000000001
0 2 1.00000000001
-1 1 1.00000000001
0 0 1.00000000001
2
0 0 1.0000001
0 0 1
2
0 0 1
0.00000001 0 1
0


Sample Output

3
5
4
2
2


Source:?Asia 2002, Kanazawa (Japan)
Submit????Status


#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath>using namespace std;const double eps=5*(1e-13); const double pi=acos(-1.0);int n;struct Point {double x,y;Point(){}Point(double _x,double _y):x(_x),y(_y){} };struct Circle {Point c;double r;Circle(){}Circle(Point _c,double _r):c(_c),r(_r){}Point point(double x) {return Point(c.x+cos(x)*r,c.y+sin(x)*r);} };double normal(double x) {return x-floor(x/(2*pi))*2*pi; }double dcmp(double x) {if(fabs(x)<=eps) return 0;return (x<0)?

-1:1; } double DIST(Point a,Point b) { return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); } Circle C[200]; double a[1000]; int tot=0; bool flag[110]; void check(Point x) { for(int i=n-1;i>=0;i--) { double d=DIST(x,C[i].c); if(dcmp(d-C[i].r)<0) { flag[i]=true; break; } } } int main() { while(scanf("%d",&n)!=EOF&&n) { memset(flag,0,sizeof(flag)); for(int i=0;i<n;i++) { double x,y,z; scanf("%lf%lf%lf",&x,&y,&z); C[i]=Circle(Point(x,y),z); } for(int i=0;i<n;i++) { tot=0; for(int j=0;j<n;j++) { if(i==j) continue; double dist=DIST(C[i].c,C[j].c); double ri=C[i].r,rj=C[j].r; if(dcmp(dist-ri-rj)>=0||dcmp(dist-fabs(ri-rj))<=0) continue; double t=atan2(C[j].c.y-C[i].c.y,C[j].c.x-C[i].c.x); double dt= acos((ri*ri+dist*dist-rj*rj)/(2.*ri*dist)); a[tot++]=normal(t+dt); a[tot++]=normal(t-dt); } a[tot++]=0;a[tot++]=2*pi; sort(a,a+tot); tot=unique(a,a+tot)-a; for(int j=0;j<tot-1;j++) { double u=(a[j]+a[j+1])/2; double r1=C[i].r+eps,r2=C[i].r-eps; Point p1=Point(C[i].c.x+r1*cos(u),C[i].c.y+r1*sin(u)); Point p2=Point(C[i].c.x+r2*cos(u),C[i].c.y+r2*sin(u)); check(p1); check(p2); } } int ans=0; for(int i=0;i<n;i++) if(flag[i]) ans++; printf("%d\n",ans); } return 0; }




總結

以上是生活随笔為你收集整理的ZOJ 1696 Viva Confetti 计算几何的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 国产成人精品免高潮费视频 | 国产乱人对白 | 伊人色综合久久久 | 美女av影院 | 黄色一级带 | 特黄特色大片免费视频大全 | 国产伦精品一区二区 | 污污网站在线观看 | 九九九热 | 噜噜视频 | 日韩精品一区二区av | 动漫av网站 | sm乳奴虐乳调教bdsm | 男裸体无遮挡网站 | 四虎永久在线视频 | 国产精品传媒麻豆hd | 精品熟妇一区二区三区 | www.99精品 | 国产精品亚洲成在人线 | 少妇流白浆 | 亚洲精品一品 | 日韩免费视频一区二区 | 亚洲一区二区三区在线看 | 亚洲一区网| 亚洲熟女综合色一区二区三区 | 丝袜人妻一区二区三区 | 三级网站 | 伊人精品视频 | 亚洲伊人色| 国产调教在线观看 | 拍国产真实乱人偷精品 | 国产精品永久免费视频 | 91福利在线导航 | 日韩在线视频在线观看 | 美国爱爱视频 | 黄色电影在线视频 | 在线va视频 | 亚洲欧美综合视频 | 性xxxxxxxxx| 天堂www中文在线资源 | 丝袜五月天| 成年人免费观看视频网站 | 牛人盗摄一区二区三区视频 | 大陆明星乱淫(高h)小说 | 亚洲情射 | 中文字幕在线有码 | 三上悠亚久久 | 日韩社区 | 极品销魂美女少妇尤物 | 18禁肉肉无遮挡无码网站 | 91亚洲视频在线观看 | 亚洲我射av | 色婷婷aⅴ一区二区三区 | 日韩香蕉视频 | 日本伦理片在线播放 | 摸丰满大乳奶水www免费 | 人成在线视频 | 亚洲第一综合 | 亚洲自拍天堂 | 欧美极品少妇xxxxⅹ喷水 | 国产乱子伦视频一区二区三区 | 黄色美女免费网站 | 最新超碰 | 国产农村妇女毛片精品久久 | 国产奶水涨喷在线播放 | 69精品人妻一区二区三区 | 日韩成人高清视频 | 首尔之春在线观看 | 中文国产在线观看 | 国产成人精品在线视频 | 青青草日本 | 麻豆国产在线 | 日韩精品一区二区三区中文字幕 | 中文字幕在线播放第一页 | 毛片基地免费 | 欧美在线 | 国产香蕉一区 | 超污网站在线观看 | 91久久国产视频 | proumb性欧美在线观看 | 免费的黄色片 | 青娱乐国产 | 亚欧美日韩| 欧美日韩一二区 | 秋霞在线观看秋 | 91精品国产高清 | a级黄色小视频 | 丝袜一区二区三区四区 | 免费看成人片 | 中文天堂av | 97人人澡人人爽人人模亚洲 | 美女免费黄色 | jizzjizz日本人 | 国产精一区 | 99久久久无码国产精品性青椒 | 在线视频欧美一区 | 熟女丰满老熟女熟妇 | 人妻互换一区二区三区四区五区 | 国产精品久久久久久久毛片 |