当前位置:网站首页>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");
}
}
}边栏推荐
- 一文了解數據异常值檢測方法
- If the array values match each other, shuffle again - PHP
- Manjaro install wechat
- 没有Kubernetes怎么玩Dapr?
- Add log file to slim frame - PHP
- Famous blackmail software stops operation and releases decryption keys. Most hospital IOT devices have security vulnerabilities | global network security hotspot on February 14
- ArcGIS application (XXII) ArcMap loading lidar Las format data
- Unity text superscript square representation +text judge whether the text is empty
- 小程序容器技术与物联网 IoT 可以碰撞出什么样的火花
- yolov5 xml数据集转换为VOC数据集
猜你喜欢

Bishi blog (13) -- oral arithmetic test app

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

09 softmax regression + loss function

The basic syntax of mermaid in typera

L1 regularization and L2 regularization
![[CV] Wu Enda machine learning course notes | Chapter 9](/img/de/41244904c8853b8bb694e05f430156.jpg)
[CV] Wu Enda machine learning course notes | Chapter 9

snipaste 方便的截图软件,可以复制在屏幕上

Educational Codeforces Round 119 (Rated for Div. 2)

SSRF vulnerability exploitation - attack redis

Unity text superscript square representation +text judge whether the text is empty
随机推荐
Cancel ctrl+alt+delete when starting up
Take you to master the formatter of visual studio code
string. Format without decimal places will generate unexpected rounding - C #
Famous blackmail software stops operation and releases decryption keys. Most hospital IOT devices have security vulnerabilities | global network security hotspot on February 14
广和通高性能4G/5G无线模组解决方案全面推动高效、低碳智能电网
Parallel shift does not provide any acceleration - C #
Redis sentinel mechanism
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)
Conversion of yolov5 XML dataset to VOC dataset
awk从入门到入土(6)正则匹配
ArcGIS应用(二十二)Arcmap加载激光雷达las格式数据
manjaro安装微信
Codeforces Round #803 (Div. 2)(A-D)
09 softmax regression + loss function
A single element in an ordered array
Need help resetting PHP counters - PHP
Use preg_ Match extracts the string into the array between: & | people PHP
User login function: simple but difficult
es6总结
The right way to capture assertion failures in NUnit - C #