QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#786477#6423. FireworksLJY_ljyWA 1ms3940kbC++111006b2024-11-26 21:43:592024-11-26 21:43:59

Judging History

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

  • [2024-11-26 21:43:59]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3940kb
  • [2024-11-26 21:43:59]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

const double eps = 1e-7;
long long n, m, p;

inline long long read() {
	long long x = 0, f = 1;
	char ch = getchar();
	while (!isdigit(ch)) {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (isdigit(ch)) {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}

int main() {
	long long t = read();
	while (t--) {
		n = read(); m = read(); p = read();
		if (p == 1e4) printf("%lld\n", n + m);
		else {
			int N = 1;
			double P = (1e4 - p) / (1e4 * 1.0000000);
			double Mi = P, E;
			while (N <= 200) {
				E = (N * n + m) / (1 - Mi);
				double Mi2 = 1;
				bool flag = true;
				for (long long i = 1; i < N; i++) {
					Mi2 = Mi2 * p;
					if (Mi2 * (1 - P) * E - n < eps) {
						flag = false;
						break;
					}
				}
				if (flag && Mi * (1 - P) * E - n < eps) break;
				Mi *= P; N++;
			}
			printf("%.10lf\n", E);
		} 
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1 1 5000
1 1 1
1 2 10000

output:

4.0000000000
10141.5852891148
3

result:

ok 3 numbers

Test #2:

score: 0
Accepted
time: 0ms
memory: 3808kb

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:

89.7298056505
200.3484320557
177.3462783172
416.8398778004
90.2934537246
149.5694213627
190.6725070858
164.6015211156
139.3497013935
275.1331102484
167.3640167364
207.1907373553
300.7322175732
589.0588489505
101.8770282124
10796.8872669046
229.7921478060
303.9373704812
153.4419337888
68.5345696432

result:

ok 20 numbers

Test #3:

score: 0
Accepted
time: 0ms
memory: 3768kb

input:

10
954269343 987322500 9806
916720797 981711601 9728
902477101 957414437 9250
967013471 988735825 9674
985383693 926528961 9411
970653208 917703218 9331
998423148 911924940 9283
986159007 902133513 9759
953796828 947934512 9959
995334734 931874197 9944

output:

1980003919.0291657448
1951513567.0230262280
2010693554.5945944786
2021655257.3909447193
2031572260.1211347580
2023744964.0981674194
2057899480.7713024616
1934924193.0525667667
1909560538.2066471577
1938062078.6403863430

result:

ok 10 numbers

Test #4:

score: 0
Accepted
time: 0ms
memory: 3760kb

input:

10
933722894 72 9673
975866948 5 9424
910984544 95 9682
994597175 6 9351
972675086 51 9712
952759975 51 9114
956482031 85 9478
921988922 72 9017
950640658 36 9893
965297247 78 9342

output:

965287879.6650469303
1035512471.3497452736
940905431.7289816141
1063626543.6851673126
1001518880.7660626173
1045380761.4658766985
1009160282.7600760460
1022500825.1081291437
960922565.4503184557
1033287652.5369299650

result:

ok 10 numbers

Test #5:

score: 0
Accepted
time: 0ms
memory: 3940kb

input:

10
910088095 81 316
970640211 35 537
908853334 41 89
932269507 8 457
953224740 22 113
959834859 69 34
924852390 63 115
952730384 97 382
917634328 91 20
937287266 32 654

output:

28800258734.1772499084
18075237355.6797103882
102118356741.5728149414
20399770568.9278068542
84356173628.3187561035
282304390588.2387084961
80421952434.7829284668
24940588507.8533973694
458817209499.9995727539
14331610061.1620769501

result:

ok 10 numbers

Test #6:

score: 0
Accepted
time: 0ms
memory: 3872kb

input:

10
968675373 962412132 104
923494255 934310785 381
922721350 957856460 282
978335370 917228676 825
951116860 942542480 359
999013758 972493824 676
930242700 964474169 342
968944030 984608304 520
965837594 909045242 369
990484700 925952624 479

output:

106669104052.2946777344
31076848077.7611122131
40771434362.8951339722
16579259543.3635272980
33660076568.7019233704
20209258011.5019226074
34581380127.3950958252
24798113234.3329429626
33145494087.7282524109
26925682159.1200637817

result:

ok 10 numbers

Test #7:

score: -100
Wrong Answer
time: 1ms
memory: 3880kb

input:

10
22 972733171 975
22 973609752 512
55 987399854 126
49 967364929 642
23 948126474 513
25 962813818 421
93 933323422 113
58 950364131 647
82 991906690 682
31 957667404 402

output:

972736672.6812933683
973640657.3720649481
1072318834.3576216698
967376397.0292350054
948156347.1906089783
962995689.9627425671
1040534226.1400827169
950377203.5935013294
991923706.5853917599
957935112.1398175955

result:

wrong answer 3rd numbers differ - expected: '987457697.39678', found: '1072318834.35762', error = '0.08594'