#include <cstdio>
typedef long long ll;
#define putmax(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 = 0;
scanf("%lld%lld%lld%lld%lld",&LH,&S,&D,&L,&B);
putmax(res,calc(LH,S,D,L,B));
putmax(res,calc(LH,D,S,B,L));
printf("%lld",res);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1088 KB |
Output is correct |
2 |
Correct |
0 ms |
1088 KB |
Output is correct |
3 |
Correct |
0 ms |
1088 KB |
Output is correct |
4 |
Correct |
0 ms |
1088 KB |
Output is correct |
5 |
Correct |
0 ms |
1088 KB |
Output is correct |
6 |
Correct |
0 ms |
1088 KB |
Output is correct |
7 |
Correct |
0 ms |
1088 KB |
Output is correct |
8 |
Correct |
0 ms |
1088 KB |
Output is correct |
9 |
Correct |
0 ms |
1088 KB |
Output is correct |
10 |
Correct |
0 ms |
1088 KB |
Output is correct |
11 |
Correct |
0 ms |
1088 KB |
Output is correct |
12 |
Correct |
0 ms |
1088 KB |
Output is correct |
13 |
Correct |
0 ms |
1088 KB |
Output is correct |
14 |
Correct |
0 ms |
1088 KB |
Output is correct |
15 |
Correct |
0 ms |
1088 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1088 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1088 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1088 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1088 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |