309668: CF1716A. 2-3 Moves

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

2-3 Moves

题意翻译

题目描述:你现在站在坐标线上的 $0$ 点。你的目标是到达这条线上的点 $n$。一个单位时间内,你可以向左或向右移动 $2$ 或 $3$ 格。(例如如果你现在位于 $x$ 点,你可以移动向 $x-3$,$x-2$,$x+2$ 或 $x+3$)。注意移动后的新位置可能会是负值。 你的任务是求出从 $0$ 点到 $n$ 点的最短时间。 输入格式:第一行一个整数 $t$ 表示数据组数。 接下来的 $t$ 行每行输入一个 $n$ 表示需要到达的点 $n$。 输出格式:对于每组数据,输出一个整数表示从 $0$ 点到 $n$ 点的最短时间。 $1 \leq t \leq 10^4$,$1 \leq n \leq 10^9$。

题目描述

You are standing at the point $ 0 $ on a coordinate line. Your goal is to reach the point $ n $ . In one minute, you can move by $ 2 $ or by $ 3 $ to the left or to the right (i. e., if your current coordinate is $ x $ , it can become $ x-3 $ , $ x-2 $ , $ x+2 $ or $ x+3 $ ). Note that the new coordinate can become negative. Your task is to find the minimum number of minutes required to get from the point $ 0 $ to the point $ n $ . You have to answer $ t $ independent test cases.

输入输出格式

输入格式


The first line of the input contains one integer $ t $ ( $ 1 \le t \le 10^4 $ ) — the number of test cases. Then $ t $ lines describing the test cases follow. The $ i $ -th of these lines contains one integer $ n $ ( $ 1 \le n \le 10^9 $ ) — the goal of the $ i $ -th test case.

输出格式


For each test case, print one integer — the minimum number of minutes required to get from the point $ 0 $ to the point $ n $ for the corresponding test case.

输入输出样例

输入样例 #1

4
1
3
4
12

输出样例 #1

2
1
2
4

Input

题意翻译

题目描述:你现在站在坐标线上的 $0$ 点。你的目标是到达这条线上的点 $n$。一个单位时间内,你可以向左或向右移动 $2$ 或 $3$ 格。(例如如果你现在位于 $x$ 点,你可以移动向 $x-3$,$x-2$,$x+2$ 或 $x+3$)。注意移动后的新位置可能会是负值。 你的任务是求出从 $0$ 点到 $n$ 点的最短时间。 输入格式:第一行一个整数 $t$ 表示数据组数。 接下来的 $t$ 行每行输入一个 $n$ 表示需要到达的点 $n$。 输出格式:对于每组数据,输出一个整数表示从 $0$ 点到 $n$ 点的最短时间。 $1 \leq t \leq 10^4$,$1 \leq n \leq 10^9$。

Output

**题目大意**:

你现在站在坐标线上的 $0$ 点。你的目标是到达这条线上的点 $n$。一个单位时间内,你可以向左或向右移动 $2$ 或 $3$ 格。求出从 $0$ 点到 $n$ 点的最短时间。

**输入输出数据格式**:

- **输入格式**:第一行一个整数 $t$ 表示数据组数。接下来的 $t$ 行每行输入一个 $n$ 表示需要到达的点 $n$。
- **输出格式**:对于每组数据,输出一个整数表示从 $0$ 点到 $n$ 点的最短时间。

**题目描述**:

你现在站在坐标线上的 $0$ 点。你的目标是到达这条线上的点 $n$。在一个单位时间内,你可以向左或向右移动 $2$ 或 $3$ 格。求出从 $0$ 点到 $n$ 点的最短时间。

**输入输出格式**:

- **输入格式**:第一行一个整数 $t$ 表示数据组数。接下来的 $t$ 行每行输入一个 $n$ 表示需要到达的点 $n$。
- **输出格式**:对于每组数据,输出一个整数表示从 $0$ 点到 $n$ 点的最短时间。

**输入输出样例**:

- **输入样例**:
```
4
1
3
4
12
```
- **输出样例**:
```
2
1
2
4
```**题目大意**: 你现在站在坐标线上的 $0$ 点。你的目标是到达这条线上的点 $n$。一个单位时间内,你可以向左或向右移动 $2$ 或 $3$ 格。求出从 $0$ 点到 $n$ 点的最短时间。 **输入输出数据格式**: - **输入格式**:第一行一个整数 $t$ 表示数据组数。接下来的 $t$ 行每行输入一个 $n$ 表示需要到达的点 $n$。 - **输出格式**:对于每组数据,输出一个整数表示从 $0$ 点到 $n$ 点的最短时间。 **题目描述**: 你现在站在坐标线上的 $0$ 点。你的目标是到达这条线上的点 $n$。在一个单位时间内,你可以向左或向右移动 $2$ 或 $3$ 格。求出从 $0$ 点到 $n$ 点的最短时间。 **输入输出格式**: - **输入格式**:第一行一个整数 $t$ 表示数据组数。接下来的 $t$ 行每行输入一个 $n$ 表示需要到达的点 $n$。 - **输出格式**:对于每组数据,输出一个整数表示从 $0$ 点到 $n$ 点的最短时间。 **输入输出样例**: - **输入样例**: ``` 4 1 3 4 12 ``` - **输出样例**: ``` 2 1 2 4 ```

加入题单

上一题 下一题 算法标签: