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;
}
相关推荐
Liangwei Lin几秒前
LeetCode 283. 移动零
算法
Lenyiin28 分钟前
《LeetCode 顺序刷题》61 - 70
java·c++·python·算法·leetcode·lenyiin
岁岁的O泡奶30 分钟前
NSSCTF_crypto_[LitCTF 2023]babyLCG
经验分享·python·算法·密码学·crypto·流密码
Hesionberger40 分钟前
LeetCode 78:子集生成全攻略
java·开发语言·数据结构·python·算法·leetcode·职场和发展
前端之虎陈随易42 分钟前
为什么今天还会有新语言?MoonBit 想解决什么问题?
大数据·linux·javascript·人工智能·算法·microsoft·typescript
risc12345643 分钟前
DFA 的运行过程本身就是一种特殊的、空间优化的动态规划
算法·动态规划
仍然.44 分钟前
算法题目---字符串
算法
多喝开水少熬夜1 小时前
dfs思路回溯
算法·深度优先·dfs
_F_y1 小时前
仿RabbitMQ实现消息队列-客户端模块实现
c++·算法·rabbitmq
一只小小的芙厨1 小时前
KMP总结
算法