問題一覧 > 通常問題

No.51 A Matter of Motivation

レベル : / AI推定難易度 : 140 / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 772
作問者 : yuki2006
お気に入りにしたユーザー ProblemId : 100 / 自分の提出
問題文最終更新日: 2026-06-25 01:04:44
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 44 (順位表) の他の問題:

Problem Statement

Thomas's motivation can be calculated easily.

Let \(D\) be the number of days remaining until the deadline,
and let \(W\) be the remaining amount of work. Then his motivation for that day is \(\frac{W}{D^2} \).
The value of the motivation with its fractional part truncated becomes the amount of work done on that day.

Thomas is wondering how much work he will have to do on the final day.

Given the amount of work \(W\) assigned on the first day and the number of days \(D\) until the deadline,
please calculate for Thomas how much work there will be on the last day.

(Pay attention to the constraints on the values.)

Input

\(W\)
\(D\) 

The first line contains an integer \(W (1\le W \le 10^5 )\), the amount of work, and
the second line contains an integer \(D (1 \le D \le 10^5 ) \), the number of days until the deadline.

Output

Output the amount of work on the last day.

Sample

Sample 1
Input
30
5
Output
19

The amount of work is 30, and the number of days until the deadline is 5.
Here, the motivation on day 1 is \( 30/5^2 =1.2\), so the amount of work on this day is \( 1\).
The motivation on day 2 is \( 29/4^2 =1.8125\), so the amount of work on this day is also \( 1\).
The motivation on day 3 is \( 28/3^2 =3.111..\), so the amount of work on this day is \( 3\).
The motivation on day 4 is \( 25/2^2 =6.25\), so the amount of work on this day is \( 6\).
The motivation on day 5 is \( 19/1^2 =19\), so the amount of work on this day is \( 19\).

That is, the amount of work done on the last day is \( 19\).

Sample 2
Input
100
2
Output
75

The motivation on day 1 is \( 100/2^2 =25\), so the amount of work on this day is \(25\).
The motivation on day 2 is \( 75/1^2 =75\), so the amount of work on this day is \(75\).

The amount of work done on the final day is \(75\).

Sample 3
Input
100000
1
Output
100000

The work amount of \(100000\) was finished in one day.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。