This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <deque>
#include <chrono>
#include <cassert>
#include <bitset>
#include <random>
using namespace std;
typedef long long li;
typedef long double ld;
const li MAX = 3e5 + 5;
li inf = (li)2e18;
li mod = (li)998244353;
li d, k, t;
li f(li num) {
li am = num;
am += (num / d) * k;
am += min(num % d, k);
return am;
}
void solve() {
cin >> k >> d >> t;
if (k % d != 0)
d = k - k % d + d;
else d = k;
t *= 2;
li uk1 = 0, uk2 = inf;
while (uk2 - uk1 > 1) {
li mid = (uk2 + uk1) / 2;
li am = f(mid);
if (am <= t) uk1 = mid;
else uk2 = mid;
}
if (f(uk1) < t) cout << setprecision(20) << ld(uk1) + ld(0.5);
else cout << uk1;
}
int main() {
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ios::sync_with_stdio(0);
li q;
q = 1;
while (q--) solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |