이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
typedef long long ll;
#define putmin(a,b) ((a)>(b)?(a)=(b):1)
ll calc(ll LH,ll S,ll D,ll L,ll B) {
ll R = 0;
if (S > LH*2) R += (S-LH*2)/(2*LH-L);
S -= R*(2*LH-L);
if (S > LH*2) R++,S -= (2*LH-L);
if (S > LH) D += (++R)*B;
else {
D += R*B-LH; R++;
if (D <= 0) return R;
D += B;
}
if (D > LH*2) { R += (D-LH*2)/(2*LH-B); D -= (D-LH*2)/(2*LH-B)*(2*LH-B); }
return R+1+(D>LH*2);
}
int main() {
ll LH,S,D,L,B,res = 99999999999999999LL;
scanf("%lld%lld%lld%lld%lld",&LH,&S,&D,&L,&B);
putmin(res,calc(LH,S,D,L,B));
putmin(res,calc(LH,D,S,B,L));
printf("%lld",res);
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |