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;
}
相关推荐
八解毒剂23 分钟前
数据结构-平衡二叉树——对二叉搜索树的优化
数据结构·c++·算法
运行时记录1 小时前
别再手动写提示词了 — SkillOpt 让技能文档自己进化
算法
啦啦啦啦啦zzzz1 小时前
算法总结(二分查找、双指针)
c++·算法
qq_8573058191 小时前
python语法
开发语言·python·算法
DXM05212 小时前
第9期|从机器学习到深度学习:AI遥感解译的进化逻辑
人工智能·算法·计算机视觉
小蒋学算法2 小时前
算法-阶乘函数后K个零
算法
weixin_307779132 小时前
智能模拟数据生成平台:生成式AI合成数据技术重塑开发测试效能
人工智能·测试工具·算法·测试用例
羊羊小栈3 小时前
Uplift营销供应链协同决策系统(基于Uplift因果推断与运筹优化算法)
前端·人工智能·算法·毕业设计·大作业
金融小师妹3 小时前
AI因子共振模型显示:金银比突破区间上沿,白银定价逻辑进入再校准阶段
人工智能·算法·均值算法·线性回归
J2虾虾4 小时前
C语言 typedef 用法
c语言·数据结构·算法