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;
}
相关推荐
土司大王12 分钟前
LeetCode hto100——字母异位词分组
java·算法·leetcode
Eloudy15 分钟前
预词力:LLM 的唯一形式化能力
人工智能·算法·agent
依然鸣32 分钟前
PTA团体程序设计天梯赛L1真题讲解L1-085-088
数据结构·c++·经验分享·算法·深度优先·pat考试
听取WA声一片(无恶意)1 小时前
CSP-J/S 初赛图论完全讲义
算法·csp-s初赛·csp-j初赛
Brilliantwxx1 小时前
【算法从零到千】【51-54】逆序对(分治+递归算法)
数据结构·算法·排序算法
小星星闪亮登场1 小时前
2026河南萌新联赛第四场--南阳理工学院
数据结构·算法·贪心算法·动态规划·哈希算法·广度优先
土司大王1 小时前
LeetCode hot100——两数之和
数据结构·算法·leetcode
luj_17682 小时前
大航海时代:沉浸式财商实战沙盒
c语言·开发语言·网络·经验分享·算法
Navigator_Z2 小时前
LeetCode //C - 1200. Minimum Absolute Difference
c语言·算法·leetcode
wabs6662 小时前
关于字符串【力扣344.反转字符串的思考】
数据结构·算法·leetcode