QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#506149 | #6423. Fireworks | EdisonBa | WA | 61ms | 3988kb | C++14 | 1.3kb | 2024-08-05 15:42:48 | 2024-08-05 15:42:51 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define re read()
#define INF 9223372036854775800
#define fr(i, x, y) for (int i = x, p = y; i <= p; ++i)
#define rp(i, x, y) for (int i = x, p = y; i >= p; --i)
#define Timeok ((double)clock() / CLOCKS_PER_SEC < MAX_TIME)
const double MAX_TIME = 1.0 - 0.0032;
inline ll read()
{
ll x = 0, f = 0;
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;
}
void write(ll x)
{
if (x < 0)
putchar('-'), x = -x;
if (x > 9)
write(x / 10);
putchar(x % 10 + 48);
}
inline void W(ll x, char ch)
{
write(x);
putchar(ch);
}
/*------------C-O-D-E------------*/
int main()
{
ll T = re;
while (T--)
{
long double n, m, p;
cin >> n >> m >> p;
p /= 10000;
long double mi = 1e9;
for (int i = 1; i <= 10000; i++)
{
long double ii = 1.0 * i;
long double d = (n * ii + m) / (1.0 - pow(1 - p, i));
// if(d > mi) break;
mi = min(mi, d);
}
printf("%.10Lf\n", mi);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3988kb
input:
3 1 1 5000 1 1 1 1 2 10000
output:
4.0000000000 10141.5852891136 3.0000000000
result:
ok 3 numbers
Test #2:
score: 0
Accepted
time: 61ms
memory: 3872kb
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: -100
Wrong Answer
time: 43ms
memory: 3940kb
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:
1000000000.0000000000 1000000000.0000000000 1000000000.0000000000 1000000000.0000000000 1000000000.0000000000 1000000000.0000000000 1000000000.0000000000 1000000000.0000000000 1000000000.0000000000 1000000000.0000000000
result:
wrong answer 1st numbers differ - expected: '1980003919.02917', found: '1000000000.00000', error = '0.49495'