311263: CF1958A. 1-3-5

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. 1-3-5time limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard output

In Berland, coins of worth $1$, $3$ and $5$ burles are commonly used (burles are local currency).

Eva has to pay exactly $n$ burles in a shop. She has an infinite amount of coins of all three types. However, she doesn't like to pay using coins worth $1$ burle — she thinks they are the most convenient to use.

Help Eva to calculate the minimum number of coins worth $1$ burle she has to use, if she has to pay exactly $n$ burles. Note that she can spend any number of coins worth $3$ and/or $5$ burles.

Input

The first line contains one integer $t$ ($1 \le t \le 100$) — the number of test cases.

Each test case consists of one line, containing one integer $n$ ($1 \le n \le 100$).

Output

For each test case, print one integer — the minimum number of $1$-burle coins Eva has to use.

ExampleInput
5
7
8
42
2
11
Output
1
0
0
2
0
Note

In the first test case, Eva should use $1$ coin worth $1$ burle, and $2$ coins worth $3$ burles.

In the second test case, Eva should use $1$ coin worth $3$ burles and $1$ coin worth $5$ burles.

In the third test case, Eva should use $14$ coins worth $3$ burles.

In the fourth test case, Eva should use $2$ coins worth $1$ burle.

In the fifth test case, Eva should use $2$ coins worth $3$ burles and $1$ coin worth $5$ burles.

Output

题目大意:
在贝尔兰,常用的硬币有1、3和5布雷斯(布雷斯是当地货币)。Eva必须在商店支付恰好n布雷斯。她有无限数量的三种类型的硬币。然而,她不喜欢使用价值1布雷斯的硬币支付,因为她认为它们最方便使用。帮助Eva计算,如果她必须支付恰好n布雷斯,她至少需要使用多少个价值1布雷斯的硬币。注意,她可以使用任意数量的价值3和/或5布雷斯的硬币。

输入数据格式:
第一行包含一个整数t(1≤t≤100)——测试用例的数量。
每个测试用例由一行组成,包含一个整数n(1≤n≤100)。

输出数据格式:
对于每个测试用例,打印一个整数——Eva必须使用的1布雷斯硬币的最小数量。

示例:
输入
```
5
7
8
42
2
11
```
输出
```
1
0
0
2
0
```
注意:
- 在第一个测试用例中,Eva应该使用1个价值1布雷斯的硬币和2个价值3布雷斯的硬币。
- 在第二个测试用例中,Eva应该使用1个价值3布雷斯的硬币和1个价值5布雷斯的硬币。
- 在第三个测试用例中,Eva应该使用14个价值3布雷斯的硬币。
- 在第四个测试用例中,Eva应该使用2个价值1布雷斯的硬币。
- 在第五个测试用例中,Eva应该使用2个价值3布雷斯的硬币和1个价值5布雷斯的硬币。题目大意: 在贝尔兰,常用的硬币有1、3和5布雷斯(布雷斯是当地货币)。Eva必须在商店支付恰好n布雷斯。她有无限数量的三种类型的硬币。然而,她不喜欢使用价值1布雷斯的硬币支付,因为她认为它们最方便使用。帮助Eva计算,如果她必须支付恰好n布雷斯,她至少需要使用多少个价值1布雷斯的硬币。注意,她可以使用任意数量的价值3和/或5布雷斯的硬币。 输入数据格式: 第一行包含一个整数t(1≤t≤100)——测试用例的数量。 每个测试用例由一行组成,包含一个整数n(1≤n≤100)。 输出数据格式: 对于每个测试用例,打印一个整数——Eva必须使用的1布雷斯硬币的最小数量。 示例: 输入 ``` 5 7 8 42 2 11 ``` 输出 ``` 1 0 0 2 0 ``` 注意: - 在第一个测试用例中,Eva应该使用1个价值1布雷斯的硬币和2个价值3布雷斯的硬币。 - 在第二个测试用例中,Eva应该使用1个价值3布雷斯的硬币和1个价值5布雷斯的硬币。 - 在第三个测试用例中,Eva应该使用14个价值3布雷斯的硬币。 - 在第四个测试用例中,Eva应该使用2个价值1布雷斯的硬币。 - 在第五个测试用例中,Eva应该使用2个价值3布雷斯的硬币和1个价值5布雷斯的硬币。

加入题单

上一题 下一题 算法标签: