作业帮 > 综合 > 作业

这里是一道c语言的题目,怎么编写,用最基础的语言.

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/10/04 04:16:33
这里是一道c语言的题目,怎么编写,用最基础的语言.
Chicken and rabbits are in a same cage.As we all know,chicken has two legs but rabbit has four.Now
we know the number of legs in the cage is A,please tell me how many animals may in the cage at least
and at most.
输入:The first line of the input contains the number of test cases in the file.Each test case that follows
consists of one lines.each case contains only one integer numbers A specifying the total legs in the
cage .
输出:For each test case,print a line contains the answer
#include
int main()
{
int n ,T;
scanf("%d",&n);
while(n--)
{
scanf("%d",&T);
if(T%2!=0)
printf("0 0\n");
else
{
if( T % 4 == 0)
printf("%d %d\n",T/4,T/2);
else
printf("%d %d\n",T/4+1,T/2);
}
}
return 0;
}