题库练习 Yet Another Coin Problem
← 上一题 下一题 →

A11293 | Yet Another Coin Problem

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

You have $5$ different types of coins, each with a value equal to one of the first $5$ triangular numbers: $1$ , $3$ , $6$ , $10$ , and $15$ . These coin types are available in abundance. Your goal is to find the minimum number of these coins required such that their total value sums up to exactly $n$ .

We can show that the answer always exists.

输入格式

The first line contains one integer $t$ ( $1 \le t \le 10^4$ ) — the number of test cases. The description of the test cases follows.

The first line of each test case contains an integer $n$ ( $1 \leq n \leq 10^9$ ) — the target value.

输出格式

For each test case, output a single number — the minimum number of coins required.

输入输出样例

输入 #1
14
1
2
3
5
7
11
12
14
16
17
18
20
98
402931328
输出 #1
1
2
1
3
2
2
2
3
2
3
2
2
8
26862090
C++ 编辑器
输入
输出