Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- using ull = unsigned long long;
- using ll = long long;
- using ld = long double;
- using D = long double;
- using ii = pair<int, int>;
- using vi = vector<int>;
- using vii = vector<ii>;
- using vll = vector<ll>;
- using vs = vector<string>;
- using vvi = vector<vi>;
- #define pb push_back
- #define mp make_pair
- #define all(x) x.begin(),x.end()
- #define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())
- #define rep(i, x) for(int i = 0; i < (x); i++)
- #define rrep(i, x) for(int i = (x - 1); i >= 0; i--)
- #define sqrt(x) sqrt(abs(x))
- #define y1 y1_1234413
- #define j1 j1_235
- #define y0 y0_235
- #define j0 j0_256
- #define fi first
- #define se second
- #define re return
- #define prev PREV
- #define next NEXT
- #define sz(x) ((int)x.size())
- #define vl v*2
- #define vr v*2+1
- #define endl "\n"
- template<typename T> T sqr(T a) { re a * a; }
- template<typename T> T gcd(T a, T b) { re b ? gcd(b, a % b) : a; }
- template<typename T> T sgn(T a) { re a > 0 ? 1 : (a < 0 ? -1 : 0); }
- template<typename T> T abs(T a) { re a > 0 ? a : -a; }
- const int inf = 2e9;
- const ld st = 0.000001;
- const ld pi = acos((ld)-1);
- const int N = 3e5 + 10;
- const D eps = 1e-7;
- #define FILENAME ""
- int n;
- int m;
- D s, p;
- bool f (D x) {
- D cs = s;
- for (int i = 0; i < m; i++) {
- D pay = x;
- pay -= cs * p;
- if (pay < -eps) re false;
- cs -= pay;
- if (cs <= 0) re true;
- }
- re false;
- }
- D lwb () {
- D l = 0;
- D r = 2 * s;
- for (int i = 0; i < 100; i++) {
- D c = (r + l) / 2;
- if (f (c)) r = c;
- else l = c;
- }
- re l;
- }
- int main() {
- ios::sync_with_stdio(0);
- cin.tie(0); cout.tie(0);
- //freopen ("input.txt", "r", stdin);
- //freopen ("output.txt", "w", stdout);
- cin >> s >> m >> p;
- p /= 100;
- cout << setprecision(9) << lwb ();
- re 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement