Logo
(追記) (追記ここまで)

27579번 - Fading Wind 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB15111210675.714%

문제

You're competing in an outdoor paper airplane flying contest, and you want to predict how far your paper airplane will fly. Your design has a fixed factor $k,ドル such that if the airplane's velocity is at least $k,ドル it will rise. If its velocity is less than $k$ it will descend.

Here is how your paper airplane will fly:

  • You start by throwing your paper airplane with a horizontal velocity of $v$ at a height of $h$. There is an external wind blowing with a strength of $s$.
  • While $h > 0,ドル repeat the following sequence:
    • Increase $v$ by $s$. Then, decrease $v$ by $\max(1, \left\lfloor \frac{v}{10} \right\rfloor)$. Note that $\left\lfloor \frac{v}{10} \right\rfloor$ is the value of $\frac{v}{10},ドル rounded down to the nearest integer if it is not an integer.
    • If $v \ge k,ドル increase $h$ by one.
    • If 0ドル < v < k,ドル decrease $h$ by one. If $h$ is zero after the decrease, set $v$ to zero.
    • If $v \le 0,ドル set $h$ to zero and $v$ to zero.
    • Your airplane now travels horizontally by $v$ units.
    • If $s > 0,ドル decrease it by 1ドル$.

Compute how far the paper airplane travels horizontally.

입력

The single line of input contains four integers $h,ドル $k,ドル $v,ドル and $s$ $(1 \le h, k, v, s \le 10^3),ドル where $h$ is your starting height, $k$ is your fixed factor, $v$ is your starting velocity, and $s$ is the strength of the wind.

출력

Output a single integer, which is the distance your airplane travels horizontally. It can be shown that this distance is always an integer.

제한

예제 입력 1

1 1 1 1

예제 출력 1

1

예제 입력 2

2 2 2 2

예제 출력 2

9

예제 입력 3

1 2 3 4

예제 출력 3

68

예제 입력 4

314 159 265 358

예제 출력 4

581062

힌트

출처

ICPC > Regionals > North America > Mid-Atlantic Regional > 2022 Mid-Atlantic USA Regional Contest > Division 1 A번

ICPC > Regionals > North America > South Central USA Regional > 2022 South Central USA Regional Contest > Division 1 A번

ICPC > Regionals > North America > Southeast USA Regional > 2022 Southeast USA Regional Programming Contest > Division 1 A번

ICPC > Regionals > North America > Mid-Atlantic Regional > 2022 Mid-Atlantic USA Regional Contest > Division 2 B번

ICPC > Regionals > North America > South Central USA Regional > 2022 South Central USA Regional Contest > Division 2 B번

ICPC > Regionals > North America > Southeast USA Regional > 2022 Southeast USA Regional Programming Contest > Division 2 B번

ICPC > Regionals > North America > Pacific Northwest Regional > 2022 ICPC Pacific Northwest Region > Division 2 G번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /