当前位置:网站首页>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");
}
}
}边栏推荐
- WordPress get_ Users() returns all users with comparison queries - PHP
- awk从入门到入土(18)gawk线上手册
- Collections in Scala
- Démarrage des microservices: passerelle
- 2022 electrician (intermediate) examination question bank and electrician (intermediate) examination questions and analysis
- 转:优秀的管理者,关注的不是错误,而是优势
- deno debugger
- Example analysis of C # read / write lock
- yolov5 xml数据集转换为VOC数据集
- Ehrlich sieve + Euler sieve + interval sieve
猜你喜欢

微服务入门:Gateway网关

User login function: simple but difficult

Go zero micro service practical series (IX. ultimate optimization of seckill performance)

yolov5 xml数据集转换为VOC数据集

Manjaro install wechat

FOC控制

随机事件的关系与运算

go-zero微服务实战系列(九、极致优化秒杀性能)

Codeforces Round #750 (Div. 2)(A,B,C,D,F1)

ArcGIS应用(二十二)Arcmap加载激光雷达las格式数据
随机推荐
Flutter 集成 amap_flutter_location
Getting started with microservices: gateway gateway
A single element in an ordered array
埃氏筛+欧拉筛+区间筛
PHP session variable passed from form - PHP
deno debugger
A method for detecting outliers of data
Li Kou today's question -1200 Minimum absolute difference
Question 49: how to quickly determine the impact of IO latency on MySQL performance
FOC控制
力扣今日题-1200. 最小绝对差
es6总结
Group programming ladder race - exercise set l1-006 continuity factor
awk从入门到入土(5)简单条件匹配
根据数字显示中文汉字
Bishi blog (13) -- oral arithmetic test app
Laravel page load problem connection reset - PHP
C#实现一个万物皆可排序的队列
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)
Moher College webmin unauthenticated remote code execution