問題一覧 > 通常問題

No.2259 Gas Station

レベル : / AI推定難易度 : 400 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 222
作問者 : sotanishy / テスター : milkcoffee
お気に入りにしたユーザー ProblemId : 9328 / 自分の提出
問題文最終更新日: 2023-04-06 23:57:39
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 383 (順位表) の他の問題:

Problem Statement

At a gas station, you choose an integer $x$ between $L$ and $R$, inclusive, and fill up with $x$ liters of gasoline. Gasoline costs $C$ yen per $1$ liter. You have an infinite number of $1000$-yen bills. Choose the amount of fuel appropriately and find the minimum possible change when paying using only $1000$-yen bills.

Input

$L$ $R$ $C$

  • $1 \leq L \leq R \leq 10^9$
  • $1 \leq C \leq 10^9$
  • All inputs are integers.

Output

Output the minimum achievable change on $1$ line. Print a newline at the end.

Sample

Sample 1
Input
1 3 400
Output
200

When you buy $1,2,3$ liters, the costs are $400,800,1200$ yen and the change is $600,200,800$ yen, respectively. The minimum of these, $200$, is the answer.

Sample 2
Input
4 6 200
Output
0

Sample 3
Input
100 100 1
Output
900

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