QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#506237#6423. FireworksGrunrayWA 0ms4000kbC++202.4kb2024-08-05 16:11:102024-08-05 16:11:11

Judging History

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

  • [2024-08-05 16:11:11]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4000kb
  • [2024-08-05 16:11:10]
  • 提交

answer

#define _CRT_SECURE_NO_WARNINGS
#define itn int
#define PII pair<int, int>
#define PLI pair<long long, int>
#define fep(i, a, b) for(int i = (a); i >= (b); --i)
#define rep(i, a, b) for(int i = (a); i <= (b); ++i)
#include<bits/stdc++.h>
#include<unordered_map>
using ll = long long;
using ldou = long double;
using unll = unsigned long long;
using namespace std;

inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (!isdigit(ch)) { f = ch != '-'; ch = getchar(); }
	while (isdigit(ch)) { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); }
	return f ? x : -x;
}

ll gcd(ll a, ll b) { // 最大公约数
	while (b ^= a ^= b ^= a %= b)
		;
	return a;
}
ll lcm(ll a, ll b) { // 最小公倍数
	return a / gcd(a, b) * b;
}
ll qmi(ll m, ll k, ll p) { // 快速幂
	//求 m^k mod p,时间复杂度 O(logk)。
	//m为底数,k为幂
	ll res = 1 % p, t = m;
	while (k) {
		if (k & 1) res = res * t % p;
		t = t * t % p;
		k >>= 1;
	}
	return res;
}
unll qmi(unll m, unll k, unll p) { //龟速乘
	ll res = 0, t = m;
	while (k) {
		if (k & 1) res = (res + t) % p;
		k >>= 1;
		t = (t << 1) % p;
	}
	return res;
}

////////////////////////////////////////////////////////////////////////////////


const int N = 1e5 + 50;
const int M = 2e5 + 50;
const ll INF = 0x3f3f3f3f;
const ll MODE = ll(998244353);
const double Pi = 3.1415926;
const double eps = 1e-6;
const int dx[4] = { 1,-1, 0, 0 };
const int dy[4] = { 0, 0, 1,-1 };
//priority_queue<int> p;//这是一个大根堆q
//priority_queue<int, vector<int>, greater<int> >q;//这是一个小根堆q
//priority_queue<ll, vector<ll>, greater<ll> >pq; // 小根

ll n, m;
string str;

ldou p;

ldou check(ldou mid) {
	return 1.0 * (n * mid + m) / (1 - pow(1 - p, mid));
}

void solve() {
	
	
	cin >> n >> m >> p;

	p /= 1e4;

	ldou l, r;
	l = 1.0, r = INF;
	ldou mid1, mid2;
	ldou res = INF;

	while (l < r) {
		mid1 = (l * 2 + r) / 3;
		mid2 = (l + r * 2) / 3;

		//res = min(res, min(l, r));

		if (check(mid1) < check(mid2)) {
			r = mid2 - 1;
		}
		else
			l = mid1 + 1;
	}

	cout << fixed << setprecision(8) << check(l) << '\n';




	
}

signed main() {
	std::ios::sync_with_stdio(false); std::cin.tie(0), std::cout.tie(0);
	/*freopen("out.txt", "r", stdin);
	freopen("wrt.txt", "w", stdout);*/
	int TTT = 1; cin >> TTT;
	while (TTT--) {
		solve();
	}
	/*while (cin >> n >> m) {
		solve();
	}*/

	return 0;
}

詳細信息

Test #1:

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

input:

3
1 1 5000
1 1 1
1 2 10000

output:

4.11414217
10141.58533304
3.00000000

result:

wrong answer 1st numbers differ - expected: '4.00000', found: '4.11414', error = '0.02854'