QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#647531 | #6423. Fireworks | shabi666# | AC ✓ | 314ms | 4052kb | C++20 | 958b | 2024-10-17 14:36:25 | 2024-10-17 14:36:28 |
Judging History
answer
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
using namespace std;
const int N = 1e6 + 5;
long double cal(int x, int n, int m, int p) {
return 1.0 * (x * n + m) / (1 - pow((long double)(1 - p * 1e-4), x));
}
void solve() {
int n, m, p;
cin >> n >> m >> p;
long double ans = 1e30;
int l = 1, r = INT_MAX;
while (l <= r) {
int lmid = l + (r - l) / 3;
int rmid = r - (r - l) / 3;
long double lans = cal(lmid, n, m, p);
long double rans = cal(rmid, n, m, p);
if (lans < rans) {
ans = lans;
r = rmid - 1;
}
else {
ans = rans;
l = lmid + 1;
}
}
cout << fixed << setprecision(20) << ans << endl;
}
signed main() {
ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
int T = 1;
cin >> T;
while (T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 4020kb
input:
3 1 1 5000 1 1 1 1 2 10000
output:
4.00000000000000000000 10141.58528911468495881110 3.00000000000000000000
result:
ok 3 numbers
Test #2:
score: 0
Accepted
time: 1ms
memory: 4020kb
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.72980565054798782199 200.34843205574910597611 177.34627831715208623464 416.83987780035464623674 90.29345372460495382921 149.56942136274360694026 190.67250708580262792691 164.60152111557691967381 139.34970139349701336029 275.13311024842298807558 167.36401673640166321011 207.19073735527119300981 30...
result:
ok 20 numbers
Test #3:
score: 0
Accepted
time: 1ms
memory: 3868kb
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.02916576201096177101 1951513567.02302631968632340431 2010693554.59459449804853647947 2021655257.39094472175929695368 2031572260.12113473948556929827 2023744964.09816731116734445095 2057899480.77130234963260591030 1934924193.05256666161585599184 1909560538.20664723939262330532 1938062078.6...
result:
ok 10 numbers
Test #4:
score: 0
Accepted
time: 1ms
memory: 3936kb
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.66504698956850916147 1035512471.34974531410261988640 940905431.72898155648726969957 1063626543.68516731366980820894 1001518880.76606253773206844926 1045380761.46587655978510156274 1009160282.76007587288040667772 1022500825.10812902485486119986 960922565.45031834067776799202 1033287652.5369...
result:
ok 10 numbers
Test #5:
score: 0
Accepted
time: 1ms
memory: 3712kb
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.17725032195448875427 18075237355.67971215397119522095 102118356741.57281561940908432007 20399770568.92780650593340396881 84356173628.31875778734683990479 282304390588.23873069882392883301 80421952434.78292546421289443970 24940588507.85339548625051975250 458817209499.99959248304367065430 ...
result:
ok 10 numbers
Test #6:
score: 0
Accepted
time: 1ms
memory: 3932kb
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.29462458193302154541 31076848077.76109516620635986328 40771434362.89514278620481491089 16579259543.36353013478219509125 33660076568.70191111415624618530 20209258011.50192304514348506927 34581380127.39510078355669975281 24798113234.33294085972011089325 33145494087.72825171053409576416 26...
result:
ok 10 numbers
Test #7:
score: 0
Accepted
time: 1ms
memory: 3976kb
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.68129344179760664701 973616306.98693591688061133027 987457697.39677932491758838296 967376069.31548532360466197133 948133283.10161393281305208802 962822722.64757909788750112057 933426898.31772819516481831670 950377057.36334316269494593143 991923706.58539166109403595328 957678776.96534543082...
result:
ok 10 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 4040kb
input:
10 47 972371220 9743 65 949941115 9400 86 921812690 9736 11 927065494 9182 71 923766617 9378 63 941828720 9029 96 917539847 9084 88 952051332 9499 91 958386812 9427 64 950375055 9887
output:
972371465.90179026866098865867 949941549.32047292508650571108 921813131.82122612698003649712 927065583.85839012090582400560 923767096.49396599171450361609 941829231.44262272596824914217 917540568.64706635847687721252 952051875.05521520663751289248 958387391.92101379594532772899 950375326.49561889446...
result:
ok 10 numbers
Test #9:
score: 0
Accepted
time: 1ms
memory: 3964kb
input:
10 98 46 9403 99 89 9661 80 62 9450 25 20 9283 68 74 9328 54 14 9286 4 80 9574 35 61 9420 77 47 9943 22 9 9358
output:
153.14261405934275891982 194.59683262602213685288 150.26455026455025466847 48.47570828395992601628 152.22984562607202917162 73.22851604566012628100 87.73762272822226600949 101.91082802547770056606 124.71085185557677857404 33.12673648215430377909
result:
ok 10 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 4024kb
input:
10 89 77 65 53 41 913 47 67 488 89 13 267 20 60 427 58 72 690 23 60 677 43 38 775 52 68 343 83 61 805
output:
15149.28383823870451863058 795.19595967869586128352 1340.26261031728188377610 3590.64750473240940298325 734.46310782457054983086 1204.04404179892616666425 568.43253704695870465180 761.45344976166006106810 1986.66955837413658991775 1378.15844833914758682525
result:
ok 10 numbers
Test #11:
score: 0
Accepted
time: 1ms
memory: 4024kb
input:
20 5 1000000000 4 3 999999979 5 5 1000000000 2 2 999999999 4 3 999999983 1 3 999999984 1 3 999999987 3 3 999999974 1 2 999999998 1 1 999999981 2 4 999999971 4 3 999999992 1 5 999999973 4 4 999999984 4 3 999999972 4 2 999999994 4 2 999999980 5 4 999999970 5 2 999999980 2 4 999999983 4
output:
1000153595.96684606972848996520 1000078103.93771904485765844584 1000289896.62138845911249518394 1000066017.48627799871610477567 1000342407.04346446966519579291 1000342408.04349445836851373315 1000125100.23510186845669522882 1000342398.04319457162637263536 1000236387.47266457852674648166 1000066005.5...
result:
ok 20 numbers
Test #12:
score: 0
Accepted
time: 314ms
memory: 4052kb
input:
10000 15 999999991 6 16 999999975 2 12 999999978 9 7 999999993 4 19 999999980 5 20 999999977 5 13 999999995 10 11 999999979 6 19 999999995 5 6 999999982 10 15 999999978 1 2 999999974 5 12 999999980 4 18 999999997 1 12 999999992 10 20 999999970 6 2 999999999 2 13 999999984 1 16 999999984 2 16 9999999...
output:
1000289834.62743380025494843721 1000834644.98037364066112786531 1000162916.05442031653365120292 1000209141.23876039031893014908 1000424660.55730170593596994877 1000444958.75894362945109605789 1000159181.22236682311631739140 1000218214.14908771059708669782 1000424675.55787137406878173351 1000078088.8...
result:
ok 10000 numbers
Test #13:
score: 0
Accepted
time: 2ms
memory: 4028kb
input:
50 3 999999983 9 8 999999973 7 6 999999988 9 17 999999995 10 19 999999993 6 13 999999989 6 17 999999995 1 8 999999999 7 9 999999971 3 15 999999986 8 2 1000000000 8 9 999999975 4 8 999999980 2 4 999999970 9 2 999999990 10 8 999999983 3 15 999999985 5 16 999999991 7 20 999999986 5 15 999999990 6 15 99...
output:
1000045336.02308302570600062609 1000141407.88145321951014921069 1000086075.41639076446881517768 1000203604.14665875205537304282 1000359647.07166234258329495788 1000254285.62847461109049618244 1001645751.81548573327017948031 1000141433.88175027980469167233 1000342363.79586271173320710659 1000222739.4...
result:
ok 50 numbers