Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:我官方数据都过了,但交上去就是WA,莫非数据加强了?哪位路过的大虾帮忙看一下……In Reply To:我官方数据都过了,但交上去就是WA,莫非数据加强了?哪位路过的大虾帮忙看一下…… Posted by:695375900 at 2009-08-14 10:49:48 > #include<iostream> > #include<cmath> > using namespace std; > int main() > { > freopen("1.txt","w",stdout); > int t; > scanf("%d",&t); > while(t--) > { > double ax,ay,bx,by,cx,cy; > scanf("%lf%lf%lf%lf%lf%lf",&ax,&ay,&bx,&by,&cx,&cy); > double hy=(((cx-ax)*(ax-bx)+(ay-by)*cy)*(cx-bx)+(by-cy)*(ax-bx)*ay)/((by-cy)*(ax-bx)+(cx-bx)*(ay-by)); > double hx; > if(abs(ax-bx)>1e-8)hx=cx-(hy-cy)*(ay-by)/(ax-bx); > else hx=ax-(ay-hy)*(by-cy)/(cx-bx); > printf("%.4lf %.4lf\n",hx,hy); > } > return 0; > } 除数会不会为0 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator