#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
cout << fixed << setprecision(7);
for (int t = 1; t <= T; ++t) {
double C, F, X;
cin >> C >> F >> X;
double rate = 2.0;
double time_spent = 0.0;
while (true) {
double time_without_buying = X / rate;
double time_with_buying = (C / rate) + (X / (rate + F));
if (time_without_buying <= time_with_buying) {
time_spent += time_without_buying;
break;
} else {
time_spent += C / rate;
rate += F;
}
}
cout << "Case #" << t << ": " << time_spent << "\n";
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |