当前位置:网站首页>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");
}
}
}边栏推荐
- NewH3C——ACL
- Codeforces Round #793 (Div. 2)(A-D)
- [Chongqing Guangdong education] National Open University spring 2019 455 logistics practice reference questions
- Example analysis of C # read / write lock
- L1 regularization and L2 regularization
- Unity text superscript square representation +text judge whether the text is empty
- Démarrage des microservices: passerelle
- Bishi blog (13) -- oral arithmetic test app
- C#,数值计算(Numerical Recipes in C#),线性代数方程的求解,Gauss-Jordan消去法,源代码
- 小程序容器技术与物联网 IoT 可以碰撞出什么样的火花
猜你喜欢

C, Numerical Recipes in C, solution of linear algebraic equations, Gauss Jordan elimination method, source code

Turn: excellent managers focus not on mistakes, but on advantages

ctfshow web255 web 256 web257

What if the wireless network connection of the laptop is unavailable

DM8 database recovery based on point in time

【无标题】转发最小二乘法

How to solve the problem that computers often flash

Unity text superscript square representation +text judge whether the text is empty

ES6 summary

A method for detecting outliers of data
随机推荐
Use preg_ Match extracts the string into the array between: & | people PHP
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)
awk从入门到入土(18)gawk线上手册
Flutter integrated amap_ flutter_ location
How to choose solid state hard disk and mechanical hard disk in computer
C#实现一个万物皆可排序的队列
SQL statement view SQL Server 2005 version number
[CV] Wu Enda machine learning course notes | Chapter 9
Codeforces Round #750 (Div. 2)(A,B,C,D,F1)
What sparks can applet container technology collide with IOT
2022 electrician (intermediate) examination question bank and electrician (intermediate) examination questions and analysis
Group programming ladder race - exercise set l1-006 continuity factor
Sports [running 01] a programmer's half horse challenge: preparation before running + adjustment during running + recovery after running (experience sharing)
User login function: simple but difficult
Unity write word
System disk expansion in virtual machine
Laravel page load problem connection reset - PHP
The upper layer route cannot Ping the lower layer route
Newh3c - network address translation (NAT)
Group programming ladder race - exercise set l2-002 linked list de duplication