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 |
为什么WA了...#include <cstdio> #include <algorithm> #include <cmath> #define eps 1e-7 using namespace std; const int maxn = 10000+10; struct village { double o,l; bool operator < (const village& b) const { return l<b.l || fabs(l-b.l)<=eps && o > b.o; } }a[maxn]; int main() { int L, D; double u, v, t; int n; while(scanf("%d%d%d",&L,&D,&n) != EOF) { for(int i(0); i < n; i++) { scanf("%lf%lf",&u,&v); t = sqrt(D*D - v*v); u = max(u-t,0.0); v = min(u+t,(double)L); a[i].o = u, a[i].l = v; } sort(a,a+n); int cnt(1); double pos = a[0].l; for(int i(0); i < n; i++) { if(pos<a[i].o) {pos=a[i].l;cnt++;} } printf("%d\n",cnt); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator