이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MAXL = 20;
const int MAXN = 300005;
using lint = long long;
using pi = pair<int, int>;
lint k, d, t;
lint trial(lint x){
// cout << "f(" << x << ")=";
lint rep = (x / (2 * d));
x %= 2 * d;
rep *= (2 * k + d - k);
rep += min(x, 2 * k);
x -= min(x, 2 * k);
rep += x / 2;
// cout << rep << endl;
return rep;
}
int main(){
cin >> k >> d >> t;
d *= (k + d - 1) / d;
// ontime = k, offtime = d - k
lint s = 0, e = 4e18;
while(s != e){
lint m = (s+e)/2;
if(trial(m) < 2 * t) s = m + 1;
else e = m;
}
printf("%.1f\n", s * 0.5);
}
# | 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... |