A. Shizuku Hoshikawa and Farm Legs

Kaori wants to spend the day with Shizuku! However, the zoo is closed, so they are visiting Farmer John's farm instead.

At Farmer John's farm, Shizuku counts n legs. It is known that only chickens and cows live on the farm; a chicken has 2 legs, while a cow has 4.

Count how many different configurations of Farmer John's farm are possible. Two configurations are considered different if they contain either a different number of chickens, a different number of cows, or both.

Note that Farmer John's farm may contain zero chickens or zero cows.

Input

The first line contains a single integer t (1≤t≤100) --- the number of test cases.

The only line of each test case contains a single integer n (1≤n≤100).

Output

For each test case, output a single integer, the number of different configurations of Farmer John's farm that are possible.

Example

Input

Copy

复制代码

5

2

3

4

6

100

Output

Copy

复制代码

1

0

2

2

26

Note

For n=4, there are two possible configurations of Farmer John's farm:

  • he can have two chickens and zero cows, or
  • he can have zero chickens and one cow.

It can be shown that these are the only possible configurations of Farmer John's farm.

For n=3, it can be shown that there are no possible configurations of Farmer John's farm.

解题说明:此题找规律即可,首先n必须是偶数,在偶数的情况下最多可能次数为n/4+1,因为每次都是去掉一头年的情况。

cpp 复制代码
#include<stdio.h>
int main()
{
	int n, t;
	scanf("%d", &t);
	while (t--)
	{
		scanf("%d", &n);
		if (n % 2 == 0)
		{
			printf("%d\n", n / 4 + 1);
		}
		else
		{
			printf("%d\n", 0);
		}
	}
	return 0;
}
相关推荐
NAGNIP10 小时前
一文搞懂深度学习中的通用逼近定理!
人工智能·算法·面试
颜酱18 小时前
单调栈:从模板到实战
javascript·后端·算法
CoovallyAIHub1 天前
仿生学突破:SILD模型如何让无人机在电力线迷宫中发现“隐形威胁”
深度学习·算法·计算机视觉
CoovallyAIHub1 天前
从春晚机器人到零样本革命:YOLO26-Pose姿态估计实战指南
深度学习·算法·计算机视觉
CoovallyAIHub1 天前
Le-DETR:省80%预训练数据,这个实时检测Transformer刷新SOTA|Georgia Tech & 北交大
深度学习·算法·计算机视觉
CoovallyAIHub1 天前
强化学习凭什么比监督学习更聪明?RL的“聪明”并非来自算法,而是因为它学会了“挑食”
深度学习·算法·计算机视觉
CoovallyAIHub1 天前
YOLO-IOD深度解析:打破实时增量目标检测的三重知识冲突
深度学习·算法·计算机视觉
NAGNIP1 天前
轻松搞懂全连接神经网络结构!
人工智能·算法·面试
NAGNIP1 天前
一文搞懂激活函数!
算法·面试
董董灿是个攻城狮1 天前
AI 视觉连载7:传统 CV 之高斯滤波实战
算法