307666: CF1393A. Rainbow Dash, Fluttershy and Chess Coloring

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

Description

Rainbow Dash, Fluttershy and Chess Coloring

题意翻译

给定一个 $n \times n$ 的矩阵,要求在上面填涂颜色。 每次填涂颜色必须在已经填涂颜色的方块旁边填涂。特别地,我们认为所有在矩阵边缘的方块是周围已经有被填涂的方块的。 对于第 $i$ 次填涂: - $i$ 是奇数:填涂的颜色是亮蓝色。 - $i$ 是偶数:填涂的颜色是黄色。 给定 $n$,求最小的填涂次数,将空白的 $n \times n$ 矩阵填涂成国际象棋棋盘状。 定义:国际象棋棋盘状是指所有方块都被填涂,并且没有两个有相邻边的方块颜色相同。 由 [Error_Eric](https://www.luogu.com.cn/user/217300) 提供翻译。

题目描述

One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size $ 1\times1 $ , Rainbow Dash has an infinite amount of light blue blocks, Fluttershy has an infinite amount of yellow blocks. The blocks are placed according to the following rule: each newly placed block must touch the built on the previous turns figure by a side (note that the outline borders of the grid are built initially). At each turn, one pony can place any number of blocks of her color according to the game rules. Rainbow and Fluttershy have found out that they can build patterns on the grid of the game that way. They have decided to start with something simple, so they made up their mind to place the blocks to form a chess coloring. Rainbow Dash is well-known for her speed, so she is interested in the minimum number of turns she and Fluttershy need to do to get a chess coloring, covering the whole grid with blocks. Please help her find that number! Since the ponies can play many times on different boards, Rainbow Dash asks you to find the minimum numbers of turns for several grids of the games. The chess coloring in two colors is the one in which each square is neighbor by side only with squares of different colors.

输入输出格式

输入格式


The first line contains a single integer $ T $ ( $ 1 \le T \le 100 $ ): the number of grids of the games. Each of the next $ T $ lines contains a single integer $ n $ ( $ 1 \le n \le 10^9 $ ): the size of the side of the grid of the game.

输出格式


For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it.

输入输出样例

输入样例 #1

2
3
4

输出样例 #1

2
3

说明

For $ 3\times3 $ grid ponies can make two following moves: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1393A/e700c5c9ebb73cd50fb6689a87a04ee305695b19.png)

Input

题意翻译

给定一个 $n \times n$ 的矩阵,要求在上面填涂颜色。 每次填涂颜色必须在已经填涂颜色的方块旁边填涂。特别地,我们认为所有在矩阵边缘的方块是周围已经有被填涂的方块的。 对于第 $i$ 次填涂: - $i$ 是奇数:填涂的颜色是亮蓝色。 - $i$ 是偶数:填涂的颜色是黄色。 给定 $n$,求最小的填涂次数,将空白的 $n \times n$ 矩阵填涂成国际象棋棋盘状。 定义:国际象棋棋盘状是指所有方块都被填涂,并且没有两个有相邻边的方块颜色相同。 由 [Error_Eric](https://www.luogu.com.cn/user/217300) 提供翻译。

加入题单

上一题 下一题 算法标签: