当前位置:网站首页>1211 or chicken and rabbit in the same cage
1211 or chicken and rabbit in the same cage
2022-07-04 08:41:00 【Zhanglilong 666】
Title Description
There are chickens and rabbits in a cage ( Chicken has 2 One foot , The rabbit has 4 One foot ). We already know the total number of feet in the cage a, Ask how many animals there are in the cage at least , How many animals at most .
Input requirements
The first line is the number of groups of test data n, Follow behind n Line input . Each group of test data takes up one line , Each line contains a positive integer a, Represents the total number of feet in the cage .
Output requirements
The output contains n That's ok , Each line corresponds to one input , contain 2 A positive integer , The first is the minimum number of animals , The second is the largest number of animals . If there is no answer that meets the requirements , Then output two 0.
sample input
2 3 20 sample output
0 0 5 10#include<cstdio>
#include<math.h>
int main(){
int n,x,y,i,j,k,max,N,zll=0,set=1,six,five,four;
scanf("%d",&x);
for(i=0;i<x;++i){
scanf("%d",&y);
if(y%2==0&&y!=0){
if(y%4==0){
printf("%d ",y/4);
}
else{
if(y%4==2){
printf("%d ",(y/4)+1);
}
}
printf("%d\n",y/2);
}
else{
printf("0 0\n");
}
}
}边栏推荐
- awk从入门到入土(15)awk执行外部命令
- [untitled] 2022 polymerization process analysis and polymerization process simulation examination
- Private collection project practice sharing [Yugong series] February 2022 U3D full stack class 007 - production and setting skybox resources
- Flutter 集成 amap_flutter_location
- awk从入门到入土(11)awk getline函数详解
- awk从入门到入土(4)用户自定义变量
- 随机事件的关系与运算
- 2022 examination questions for safety managers of metal and nonmetal mines (underground mines) and examination papers for safety managers of metal and nonmetal mines (underground mines)
- Internal learning
- Cancel ctrl+alt+delete when starting up
猜你喜欢

Codeforces Round #803 (Div. 2)(A-D)

Codeforces Round #793 (Div. 2)(A-D)

DM8 database recovery based on point in time

Redis 哨兵机制

DM8 tablespace backup and recovery

Manjaro install wechat

C#,数值计算(Numerical Recipes in C#),线性代数方程的求解,Gauss-Jordan消去法,源代码

Display Chinese characters according to numbers

How college students choose suitable computers

L1 regularization and L2 regularization
随机推荐
Const string inside function - C #
1. Kalman filter - the best linear filter
团体程序设计天梯赛-练习集 L2-002 链表去重
awk从入土到入门(10)awk内置函数
awk从入门到入土(5)简单条件匹配
DM8 tablespace backup and recovery
[BSP video tutorial] stm32h7 video tutorial phase 5: MDK topic, system introduction to MDK debugging, AC5, AC6 compilers, RTE development environment and the role of various configuration items (2022-
Educational Codeforces Round 115 (Rated for Div. 2)
manjaro安装微信
转:优秀的管理者,关注的不是错误,而是优势
Unity text superscript square representation +text judge whether the text is empty
MySQL relearn 1-centos install mysql5.7
ctfshow web255 web 256 web257
Li Kou today's question -1200 Minimum absolute difference
Codeforces Round #750 (Div. 2)(A,B,C,D,F1)
es6总结
Add log file to slim frame - PHP
C, Numerical Recipes in C, solution of linear algebraic equations, Gauss Jordan elimination method, source code
2022 electrician (intermediate) examination question bank and electrician (intermediate) examination questions and analysis
PHP session variable passed from form - PHP