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 |
同一份代码,在poj上过了,vjudge上错了```cpp #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <iostream> using namespace std; int n,h,r,T; double g = 10.0,ans[100010],d; int m; double getans(int tim) { if(tim < 0) return h; double t = sqrt(2*h/g); int k = (int)(tim/t); if(k % 2 == 0) { d = tim-k*t; return h - g*d*d/2; } else{ d = (k+1)*t-tim; return h - g*d*d/2; } } bool cmp(double a,double b) { return a < b; } int main() { int t; cin>>t; while(t--) { memset(ans,0,sizeof(ans)); scanf("%d%d%d%d",&n,&h,&r,&T); for(int i = 0;i < n;i++) ans[i] = getans(T-i); sort(ans,ans+n,cmp); for(int i = 0;i < n;i++) printf("%.2lf ",ans[i] + (double)2*r*i/100.0); printf("\n"); } return 0; } ``` Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator