問題一覧 > 通常問題

No.128 Otoshidama (1)

レベル : / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 865
作問者 : yuki2006
お気に入りにしたユーザー ProblemId : 130 / 自分の提出
問題文最終更新日: 2026-06-25 01:04:46
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 77 (順位表) の他の問題:

Problem Statement

Yasuo has a budget of $N$ yen and wants to give otoshidama (New Year's gift money) to $M$ children of his relatives.
He wants the otoshidama to consist only of 1000-yen bills, and he wants to give everyone an equal amount (all the same amount) that is as large as possible.

Find the amount of money one person receives in this case.


Input

N
M

All inputs are given as integers.
$1\le N \le 10000000000000000=10^{16}$
$1\le M \le 10000=10^{4}$

Output

Output the amount of money given to one person.

Sample

Sample 1
Input
10000
5
Output
2000

The budget is $10000$ yen and it is distributed among $5$ people, so each $1$ person receives $2000$ yen.

Sample 2
Input
24000
9
Output
2000

As long as it is equal, the budget does not have to be used up entirely.

Sample 3
Input
1000
6
Output
0

Since the budget is small, he cannot give otoshidama to anyone.

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