当前位置:网站首页>2068: [example 2.6] chicken and rabbit in the same cage
2068: [example 2.6] chicken and rabbit in the same cage
2022-06-12 13:24:00 【Xiao Liu wants to be number one】
2068:【 example 2.6】 Chicken and rabbit in the same cage
The time limit : 1000 ms Memory limit : 65536 KB
Submission number : 26814 Passing number : 14309
【 Title Description 】
Classic in Mathematics “ Chicken and rabbit in the same cage ” problem , Known head total x individual , Total feet y only , Ask how many chickens and rabbits there are in the cage ?
【 Input 】
The number of heads and feet .
【 Output 】
The number of chickens and rabbits . A space separates .
【 sample input 】
30 90【 sample output 】
15 15#include<iostream>
using namespace std;
int main()
{
int x, y;
cin >> x >> y;
int ra, ch;
for (ra = 1; ra < x; ra++)
{
ch = x - ra;
if (ch * 2 + ra * 4 == y)
cout << ch << " " << ra;
}
}边栏推荐
- Dameng database DM8 Windows environment installation
- [database] Navicat -- Oracle database creation
- Introduction to application design scheme of intelligent garbage can voice chip, wt588f02b-8s
- 微信web开发者工具使用教程,web开发问题
- C language [23] classic interview questions [2]
- Embedded driver design
- Mui login database improvement and Ajax asynchronous processing [mui+flask+mongodb+hbuilderx]
- IC chip scheme fs4062b for lithium battery charging with 5V boost to 12.6V
- jsp跳转问题,不能显示数据库数据,并且不能跳转
- 深度学习的多个 loss 是如何平衡的?
猜你喜欢

Pytorch framework

嵌入式系统概述1-嵌入式系统定义、特点和发展历程

leetcode 47. Permutations II 全排列 II(中等)

torch_geometric mini batch 的那些事

成功定级腾讯T3-2,万字解析

创新实训(十)高级界面美化

Chrome debugging tool

Multi source BFS problem template (with questions)

Introduction to application design scheme of intelligent garbage can voice chip, wt588f02b-8s

智能垃圾桶语音芯片应用设计方案介绍,WT588F02B-8S
随机推荐
[cloud native | kubernetes] actual combat of ingress case
位图、布隆过滤器和哈希切分
创新实训(十二)项目总结
Introduction to application design scheme of intelligent garbage can voice chip, wt588f02b-8s
【云原生 | Kubernetes篇】Kubernetes 网络策略(NetworkPolicy)
Innovation training (XII) project summary
手把手教你IDEA创建SSM项目结构
创新实训(十一)开发过程中的一些bug汇总
[EDA] chip layout design: VLSI layout design using electric
jsp跳转问题,不能显示数据库数据,并且不能跳转
What if the MySQL installation on the apple computer is completed and cannot be found
Overview of embedded system 2- composition and application of embedded system
Resume NFT platform trustrecruit joined Octopus network as a candidate application chain
import torch_ Geometric loads some common datasets
Script引入CDN链接提示net::ERR_FILE_NOT_FOUND问题
Newoj week 10 question solution
Getting started with NVIDIA Jetson nano Developer Kit
Title: Yanghui triangle
import torch_geometric 加载一些常见数据集
创新实训(十)高级界面美化