当前位置:网站首页>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");
}
}
}边栏推荐
- C # implements a queue in which everything can be sorted
- Call Baidu map to display the current position
- 如何通过antd的upload控件,将图片以文件流的形式发送给服务器
- Difference between static method and non static method (advantages / disadvantages)
- C#实现一个万物皆可排序的队列
- Flutter integrated amap_ flutter_ location
- Redis sentinel mechanism
- What sparks can applet container technology collide with IOT
- How to solve the problem of computer jam and slow down
- Educational Codeforces Round 115 (Rated for Div. 2)
猜你喜欢

How college students choose suitable computers

转:优秀的管理者,关注的不是错误,而是优势

Moher college phpMyAdmin background file contains analysis traceability

Take you to master the formatter of visual studio code

Educational Codeforces Round 119 (Rated for Div. 2)

es6总结

根据数字显示中文汉字

Ehrlich sieve + Euler sieve + interval sieve

Newh3c - network address translation (NAT)

The second session of the question swiping and punching activity -- solving the switching problem with recursion as the background (I)
随机推荐
Take you to master the formatter of visual studio code
Cannot click button when method is running - C #
Convert datetime string to datetime - C in the original time zone
Azure ad domain service (II) configure azure file share disk sharing for machines in the domain service
Need help resetting PHP counters - PHP
Four essential material websites for we media people to help you easily create popular models
The basic syntax of mermaid in typera
awk从入门到入土(8)数组
awk从入门到入土(7)条件语句
The second session of the question swiping and punching activity -- solving the switching problem with recursion as the background (I)
团体程序设计天梯赛-练习集 L1-006 连续因子
Comparison between sentinel and hystrix
Private collection project practice sharing [Yugong series] February 2022 U3D full stack class 007 - production and setting skybox resources
Example analysis of C # read / write lock
What if the wireless network connection of the laptop is unavailable
Add log file to slim frame - PHP
学习Nuxt.js
埃氏筛+欧拉筛+区间筛
C # implements a queue in which everything can be sorted
How to choose solid state hard disk and mechanical hard disk in computer