QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#506308#6423. FireworksssmyWA 0ms4172kbC++20707b2024-08-05 16:35:192024-08-05 16:35:19

Judging History

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

  • [2024-08-05 16:35:19]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4172kb
  • [2024-08-05 16:35:19]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> PII;
const double eps = 1e-6;
int m, n;
double p;
double check(double x)
{
	return (x * n + m) / ((1 - pow(1 - p * 1e-4, x)));
}
void solve() 
{
	std:: cin >> m >> n >> p;
	double l = 1, r = 1e6;
	while((r - l) > eps)
	{
		double mid = (l + r) / 2;
		if(check(mid - eps) < check(mid + eps))
		{
			r = mid;
		}
		else
		{
			l = mid;
		}
	}
	std:: cout << fixed << setprecision(10) << min(check(ceil(l)), check(floor(l))) << endl;
}

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
    int T;
    std:: cin >> T;
    while(T -- )
	solve();
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 4092kb

input:

3
1 1 5000
1 1 1
1 2 10000

output:

4.0000000000
10141.5852891147
3.0000000000

result:

ok 3 numbers

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 4172kb

input:

20
10 27 2855
79 59 6888
65 72 7725
78 50 2888
31 21 5759
41 58 6619
47 27 3881
35 55 5095
77 7 6028
17 89 1792
84 60 8604
58 44 4923
88 27 3824
54 63 1482
19 42 5366
93 76 97
100 99 8660
96 36 4343
90 56 9515
24 44 9922

output:

129.5971978984
200.3484320557
177.3462783172
356.0991190940
89.0092814611
149.5694213627
161.4505897494
176.6437684004
104.5517774990
591.5178571429
167.3640167364
196.7016872464
221.0800537029
636.1835568666
113.6787178531
9064.5777904316
229.7921478060
247.0648148512
153.4419337888
68.5345696432

result:

wrong answer 1st numbers differ - expected: '89.72981', found: '129.59720', error = '0.44430'