Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

同一份代码,在poj上过了,vjudge上错了

Posted by wknclizu at 2019-10-25 20:47:37 on Problem 3684
```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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator