QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#703905#8022. WalkerQFshengxiuWA 0ms3824kbC++231.5kb2024-11-02 18:50:362024-11-02 18:50:41

Judging History

你现在查看的是最新测评结果

  • [2024-11-02 18:50:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3824kb
  • [2024-11-02 18:50:36]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
double v1,w1,v2,w2,n;
signed main(){
	int t;
	cin >> t;
	while(t--){
		cin >> n >> w1 >> v1 >> w2 >> v2;
//		cout << v2 << "\n";
		double mint=1e9+7;
		if(w1>w2){
			swap(w1,w2);
			swap(v1,v2);
		}
//		cout << w1 << v1 << w2 << v2 << "\n";
		if(w1==0 && w2==n){
			cout << n/(v1+v2);
			continue;
		}
		if(w1==0){
			cout << (2*n-w2)/(v1+v2);
			continue;
		}
		if(w2==n){
			cout << (n+w1)/(v1+v2);
			continue;
		}
		//ww
		double x=(w2*v1+n*v1-w1*v2)/(v2+2*v1);
//		cout << x << "\n";
//		cout << (x+w1)*v2 << " " << (w2+n-2*x)*v1 << "\n";
		if(x<=w2){
			mint=min(mint,(x+w1)/v1);
		}
//		cout << mint << "\n";
		x=(2*n*v1-w2*v1+w1*v2)/(2*v2+v1);
		if(x>=w1){	
			mint=min(mint,(2*x-w1)/v1);
		}
		mint=min({mint,(min(n+w1,n+n-w1))/v1,(min(n+w2,n+n-w2))/v2}); 
		if(w1/v1<=(n-w1+w2-w1)/v2 && (n-w2)/v2<=(w2+w2-w1)/v1){
			cout << "qfmm" << "\n";
			mint=min(mint,(w2-w1+n)/(v1+v2));
		}
//		cout << mint << "\n";
		//1
		mint=min(mint,(w2-w1+2*n)/(v1+v2));
//		cout << mint << "\n";
		//2
		mint=min(mint,(n-w2+w1+n)/(v1+v2));
//		cout << mint << "\n";
		//3
		double t1=(w2+w1)/(v1+v2);
		double wz=abs(v1*t1-w1);
		mint=min(mint,t1+min((n-wz)/v1,(n-wz)/v2));
//		cout << mint << "\n";
		//4
		t1=(2*n-w1-w2)/(v1+v2);
//		cout << t1 << " ";
		wz=n-abs(w2+v2*t1-n);
		mint=min(mint,t1+min(wz/v1,wz/v2));
		cout << fixed << setprecision(6) << mint << "\n";
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3824kb

input:

2
10000.0 1.0 0.001 9999.0 0.001
4306.063 4079.874 0.607 1033.423 0.847

output:

qfmm
5001000.000000
qfmm
3827.837001

result:

wrong output format Expected double, but "qfmm" found