当前位置:网站首页>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");
}
}
}边栏推荐
- Fault analysis | MySQL: unique key constraint failure
- Basic operations of databases and tables ----- view data tables
- C, Numerical Recipes in C, solution of linear algebraic equations, Gauss Jordan elimination method, source code
- How college students choose suitable computers
- Need help resetting PHP counters - PHP
- 团体程序设计天梯赛-练习集 L2-002 链表去重
- How to choose solid state hard disk and mechanical hard disk in computer
- DM8 database recovery based on point in time
- 微服務入門:Gateway網關
- 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)
猜你喜欢

MySQL relearn 1-centos install mysql5.7

Redis 哨兵机制

How to play dapr without kubernetes?

User login function: simple but difficult

L1 regularization and L2 regularization
![Leetcode topic [array] -136- numbers that appear only once](/img/6d/f2e4b812e5dd872fbeb43732d6f27f.jpg)
Leetcode topic [array] -136- numbers that appear only once

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

Display Chinese characters according to numbers

微服务入门:Gateway网关

The second session of the question swiping and punching activity -- solving the switching problem with recursion as the background (I)
随机推荐
awk从入门到入土(6)正则匹配
How does Xiaobai buy a suitable notebook
Developers really review CSDN question and answer function, and there are many improvements~
[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-
ES6 summary
awk从入门到入土(14)awk输出重定向
Openfeign service interface call
OpenFeign 服务接口调用
根据数字显示中文汉字
How to play dapr without kubernetes?
How to send pictures to the server in the form of file stream through the upload control of antd
Codeforces Global Round 21(A-E)
一文了解數據异常值檢測方法
DM8 database recovery based on point in time
Add log file to slim frame - PHP
Group programming ladder race - exercise set l2-002 linked list de duplication
Educational Codeforces Round 119 (Rated for Div. 2)
The basic syntax of mermaid in typera
团体程序设计天梯赛-练习集 L1-006 连续因子
团体程序设计天梯赛-练习集 L2-002 链表去重