No.542 1-Yen Coins and 5-Yen Coins
タグ : / 解いたユーザー数 505
作問者 :
nmnmnmnmnmnmnm
/ テスター :
はむこ
Problem Statement
There are $A$ 1-yen coins and $B$ 5-yen coins.
List all the amounts that can be made, in ascending order.
Input
$A$ $B$
$A$ is the number of 1-yen coins. $A$ is a non-negative integer. $0 \le A \le 100$.
$B$ is the number of 5-yen coins. $B$ is a non-negative integer. $0 \le B \le 100$.
$A$ and $B$ are never both $0$.
Output
If there are $N$ possible amounts, output the answer on $N$ lines from top to bottom, in ascending order of amount.
Note that $0$ yen is not included in the answer.
Print a newline at the end of each line.
Sample
Sample 1
Input
2 1
Output
1 2 5 6 7
There are 2 1-yen coins and 1 5-yen coin.
The amounts that can be made are, in ascending order, 1 yen, 2 yen, 5 yen, 6 yen, and 7 yen.
Sample 2
Input
0 3
Output
5 10 15
There are no 1-yen coins.
Using only 5-yen coins, 5 yen, 10 yen, and 15 yen can be made.
Sample 3
Input
6 1
Output
1 2 3 4 5 6 7 8 9 10 11
All amounts from 1 yen to 11 yen can be made.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。