FZU 2272 Frog 第八届福建省赛 (鸡兔同笼水题)
Problem Description
Therearex frogs and y chicken in a garden. Kim found there are n heads and m legs in the garden. Please tell Kim how many frogs and chicken are there. (A frog has 4 legs, and a chicken has 2 legs.)
Input
First line contains an integer T (1 ≤ T ≤ 10), represents there are T test cases.
For each test case: Two number n and m.
1<=n, m <=100000. The data is legal.
Output
For each test case, output two numbers A and B – the number of frog and the number of chicken.
Sample Input
Sample Output
#include<cstdio>
#include<iostream>
using namespace std; int main()
{
int T;
int n,m,a,b;
scanf("%d",&T);
while(T--)
{
scanf("%d%d",&n,&m);
a=(m-*n)/;
b=n-a;
printf("%d %d\n",a,b);
}
return ;
}
FZU 2272 Frog 第八届福建省赛 (鸡兔同笼水题)的更多相关文章
- FZU 2273 Triangles 第八届福建省赛 (三角形面积交 有重边算相交)
Problem Description This is a simple problem. Given two triangles A and B, you should determine they ...
- OpenJudge计算概论-鸡兔同笼【新版题目,简单计算级别】
/*====================================================================== 鸡兔同笼 总时间限制: 1000ms 内存限制: 65 ...
- d037: 鸡兔同笼
内容: 鸡兔同笼中头的总数,脚的总数,求鸡兔各多少只 输入说明: 一行两个整数分别表示头.脚总数(保证有解,当然有可能解为0) 输出说明: 一行两个整数,分别表示鸡.兔的只数 输入样例: 20 4 ...
- Open Judge 2750 鸡兔同笼
2750:鸡兔同笼 ...
- python_鸡兔同笼问题
鸡兔同笼问题 -- 今有雉兔同笼,上有三十五头,下有九十四足,问雉兔各几何? --鸡和兔在一个笼子里,从上面数,有35个头:从下面数,有94只脚.问笼中各有几只鸡和兔 如何逻辑整理? -- 鸡头和兔子 ...
- nyoj 鸡兔同笼
鸡兔同笼 时间限制:3000 ms | 内存限制:65535 KB 难度:1 描述 已知鸡和兔的总数量为n,总腿数为m.输入n和m,依次输出鸡和兔的数目,如果无解,则输出"No an ...
- POJ 2750 鸡兔同笼
参考自:https://www.cnblogs.com/ECJTUACM-873284962/p/6414781.html POJ 2750鸡兔同笼 总时间限制:1000ms 内存限制:65536kB ...
- 鸡兔同笼问题(Java)
问题描述:编程解决鸡兔同笼问题,笼子中鸡兔共有35只,94只脚,求有鸡和兔各有几只 我的代码: /** * 鸡兔同笼问题 * @author Administrator * */ public cla ...
- 计算概论(A)/基础编程练习1(8题)/5:鸡兔同笼
#include<stdio.h> int main() { // 鸡兔同笼中脚的总数:a < 32768 int a; scanf("%d", &a); ...
随机推荐
- 关于移动端rem适配
var num = 1 / window.devicePixelRatio; var fontSize = document.documentElement.clientWidth / 10; doc ...
- python 常用代码
获取标签名 h1 class 是h1usersoup.find(name="h1", attrs={"class":"h1user"});获 ...
- SpringMvc4.2.5 零配置出现 No mapping found for HTTP request with URI(转)
原文地址:SpringMvc4.2.5 零配置出现 No mapping found for HTTP request with URI 采用 spring 零配置,参考 http://hanqunf ...
- asm ftp utilty and usage
Oracle 11g ASM supports ASM FTP, by which operations on ASM files and directories can be performed s ...
- Win10系列:VC++ Direct3D模板介绍1
Visual Studio为开发Direct3D应用程序提供了便捷的模版,读者可以不必手动去新建Direct3D中所使用到的基础资源,而只需专注于图形的绘制.本小节主要为读者介绍这个模版中用于绘制图形 ...
- SQLServer中sql for xml path 的用法
我们通常需要获取一个多行的某个字段拼出的字符串,我们可以使用for xml path进行处理:下面将介绍for xml path的具体用法: 创建测试表&插入测试数据 在数据库中新增测试表 C ...
- php 图片添加水印和二维码
$host = $_SERVER['HTTP_HOST']; $save_code_file = './qrcodes/qrcode.png'; QrCode::format()->backgr ...
- Uboot代码分析
(1)确定链接脚本文件:uboot根目录下Makefile中的LDSCRIPT宏值,就是指定链接脚本(如:arch/arm/cpu/u-boot.lds)路径用的.(2)从脚本文件找入口: 在链接脚本 ...
- ssh三大框架整合
spring+struts2+hibernate 参考1:数据库为oracle http://takeme.iteye.com/blog/1678268 参考2:数据库为mysql http://bl ...
- ng-table
需要的文件: angular.js ng-table.js ng-table.css bootrasp.css 注入依赖: var app = angular.module('app', [ 'ngT ...