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;
}
相关推荐
历程里程碑16 小时前
滑动窗口----滑动窗口最大值
javascript·数据结构·python·算法·排序算法·哈希算法·散列表
2301_8223827616 小时前
嵌入式C++实时内核
开发语言·c++·算法
wWYy.16 小时前
malloc底层实现
算法
Remember_99316 小时前
Java 工厂方法模式:解耦对象创建的优雅方案
java·开发语言·python·算法·工厂方法模式
鱼跃鹰飞16 小时前
Leetcode会员尊享面试100题:333.最大二叉搜索子树
数据结构·算法·leetcode·面试
日拱一卒——功不唐捐16 小时前
交换排序:冒泡排序和快速排序(C语言)
c语言·数据结构·算法
2301_7903009616 小时前
C++与物联网开发
开发语言·c++·算法
鱼跃鹰飞16 小时前
Leetcode会员尊享面试100题:255.验证二叉搜索树的前序遍历序列
算法·leetcode·面试
郝学胜-神的一滴16 小时前
机器学习中的特征提取:PCA与LDA详解及sklearn实践
人工智能·python·程序人生·算法·机器学习·sklearn
Dylan的码园16 小时前
深入浅出Java排序:从基础算法到实战优化(下)
java·算法·排序算法