当前位置:网站首页>Chicken and rabbit in the same cage
Chicken and rabbit in the same cage
2022-07-29 17:13:00 【seal ink】
鸡兔同笼
时间限制: 3 Sec 内存限制: 64 MB
题目描述
已知鸡和兔的总数量为n,总腿数为m.输入n和m,依次输出鸡和兔的数目,如果无解,则输出“No answer”(不要引号).
输入
Enter a data on the first linea,It represents the following sets of data,在接下来的(a<10)
a行里,每行都有一个n和m.(m>0,n<100)
输出
Output the number of chickens and rabbits,或者No answer
样例输入
2
14 32
10 16
样例输出
12 2
No answer
#include<stdio.h>
int main()
{
int N;
scanf("%d",&N);
while(N--)
{
int n,m;
int x,y=0;
scanf("%d %d",&n,&m);
for(x=1;x<=n;x++)
{
if(4*x+2*(n-x)==m)
{
printf("%d %d\n",n-x,x);
y=1;
}
}
if(y==0)
printf("No answer\n");
}
return 0;
}
边栏推荐
- Pycaret on diamond data sets using the regression problem
- 【地形】【虚拟纹理】地形虚拟纹理技术介绍
- tutorial/detailed_workflow.ipynb 量化金融Qlib库
- MySQL外键约束怎么创建
- Groeb - "gramm, explicit and complete n -" gramm mask language model, implements the explicit n - "gramm semantic unit modeling knowledge.
- 718. The longest repeat subarray
- RocketQA: across batches negative sampling (cross - batch negatives), the denoising of strong negative cases of sampling (denoised hard negative from) and data to enhance (data augment
- Steam CMD是什么?Steam CMD怎么用?
- [极客大挑战 2019]LoveSQL 1
- 1802. 有界数组中指定下标处的最大值【贪心 +二分】
猜你喜欢

Google Play 政策更新 | 2022 年 7 月

Knowledge Graph Construction of Mall Commodities

MLX90640 infrared thermal imager development notes (9)

CRM如何帮助企业营销获客

【地形】【虚拟纹理】地形虚拟纹理技术介绍

GMAT考什么?

再见Postman!一款更适合国人的接口管理工具

异步请求池的实现

澜舟孟子轻量化预训练模型技术实践

Moving forward steadily without forgetting the original intention, Volvo's sense of security comes from the public's recognition
随机推荐
Ernie-gram, 显式、完备的 n-gram 掩码语言模型,实现了显式的 n-gram 语义单元知识建模。
mysql的sql分页查询语句怎么写_sql 分页查询语句(mysql分页语句)「建议收藏」
[极客大挑战 2019]BabySQL 1
What is the GMAT test?
【软考软件评测师】自动化测试章节上篇
【上传文件】
大规模线上应用TiDB会遇到的坑,本文都帮你排除好了
STC8h1k28六个基本实验
什么时候使用UserCF,什么时候使用ItemCF?
中小型金融企业该如何进行灾备建设?
GBJ2510-ASEMI电机专用25A整流桥GBJ2510
新建和编辑共用一个表单,编辑之后新建,form表单resetFields失效
Store Information Management System
(笔记)Build was configured to prefer settings repositories over project repositories but 解决方法
GMAT考什么?
传输层 TCP的连接管理-释放连接四次握手
【 Leetcode 】 200. The number of islands (medium)
阶乘因式分解
RocketQA:通过跨批次负采样(cross-batch negatives)、去噪的强负例采样(denoised hard negative sampling)与数据增强(data augment
1802. 有界数组中指定下标处的最大值【贪心 +二分】