QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#209974#7110. Kuririn MIRACLEPetroTarnavskyiWA 0ms4204kbC++171.5kb2023-10-10 20:37:532023-10-10 20:37:53

Judging History

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

  • [2023-10-10 20:37:53]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4204kb
  • [2023-10-10 20:37:53]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first	
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

const int M = 40000;
const db PI = acos(-1.0);
const db EPS = 1e-7;

db v, r, d;

db f(db phi)
{
	db si = sin(phi);
	return -v / (2 * r) * (sqrt(3 + si * si) - si);
}

void solve()
{
	cin >> v >> r >> d;
	db ans = d / v;
	db phi = PI;
	const db dt = ans / M;
	FOR(i, 1, M + 1)
	{
		db t = i * dt;
		phi += dt * f(phi);
		db si = sin(phi), co = cos(phi);
		db a = d - 2 * r - v * t, b = a - 2 * r * co;
		if (abs(b) < EPS && phi < EPS)
		{
			ans = t;
			break;
		}
		if (b < -EPS)
			break;
		if (phi < PI / 2)
		{
			db l = sqrt(4 * r * r + a * a - 4 * r * a * cos(phi));
			db siBeta = 2 * r * si / l;
			assert(0 <= siBeta && siBeta < 1 + EPS);
			db beta = asin(min(1.0, siBeta));
			if (phi + beta <= PI / 2 && 2 * cos(phi + beta) >= cos(phi))
			{
				ans = min(ans, t + l / (2 * v));
				break;
			}
		}
		else if (phi < EPS)
		{
			ans = t + a / (2 * v);
			break;
		}
	}
	cout << ans << "\n";
	//cerr << ans - 8.310579933902352 << "\n";
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(15);
	int t;
	cin >> t;
	while (t--)
		solve();
	return 0;
}

詳細信息

Test #1:

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

input:

1
2.00 3 30.0

output:

8.310544736564115

result:

wrong answer 1st numbers differ - expected: '8.3105799', found: '8.3105447', error = '0.0000042'