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;
}
相关推荐
Lsk_Smion15 分钟前
Hot100(开刷) 之 长度最小的数组--删除倒数第N个链表--层序遍历
java·数据结构·算法·kotlin
luoganttcc16 分钟前
dim3 grid_size(2, 3, 4); dim3 block_size(4, 8, 4)算例
算法
WBluuue25 分钟前
Codeforces 1088 Div1+2(ABC1C2DEF)
c++·算法
像素猎人34 分钟前
map<数据类型,数据类型> mp和unordered_map<数据类型,数据类型> ump的讲解,蓝桥杯OJ4567最大数目
c++·算法·蓝桥杯·stl·map
Narrastory35 分钟前
Note:强化学习(一)
人工智能·算法·强化学习
沐雪轻挽萤1 小时前
1. C++17新特性-序章
java·c++·算法
郝学胜-神的一滴1 小时前
从链表到二叉树:树形结构的入门与核心性质解析
数据结构·c++·python·算法·链表
csdn_aspnet1 小时前
C语言 (QuickSort using Random Pivoting)使用随机枢轴的快速排序
c语言·算法·排序算法
玖釉-1 小时前
深入解析 meshoptimizer:基于 meshopt_computeSphereBounds 的层级包围球构建与 DAG 优化
c++·算法·图形渲染
语戚1 小时前
力扣 494. 目标和 —— 回溯 & 动态规划双解法全解(Java 实现)
java·算法·leetcode·动态规划·力扣·dp·回溯