当前位置:网站首页>阿凡提的难题
阿凡提的难题
2022-08-03 05:10:00 【-JMY-】
题目描述
阿凡提去集市上买餐具,财主正好在卖餐具,所以准备为难一下阿凡提;财主的餐具有2种:大碗和小碗,财主和阿凡提说,你买我的碗,要花光你带的钱,而且,两种碗都要买,买的两种碗的数量都得是偶数,请你编程帮助阿凡提计算,可以有哪些购买的方案呢?
输入
三个整数,分别代表了阿凡提带的钱的数量,大碗的价格,小碗的价格!
输出
所有的购买方案,一行一个方案,先输出大碗的采购只数,再输出小碗的采购只数!(大碗数量少的方案在前)
样例输入
100 20 10
样例输出
2 6 4 2
参考代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
int k,b,s;
cin>>k>>b>>s;
for(int i=2;i<=k;i+=2){
for(int j=2;j<=k;j+=2){
if(i*b+j*s==k)
cout<<i<<' '<<j<<'\n';
}
}
}
边栏推荐
- 数据分析 第一篇
- 建造者模式(Builder Pattern)
- typescript47-函数之间的类型兼容性
- 3. 无重复字符的最长子串
- Common fluorescent dyes to modify a variety of groups and its excitation and emission wavelength data in the data
- 1095 解码PAT准考证 (25 分)(C语言)
- Djiango第三次培训
- Install IIS services (Internet Information Services (Internet Information Services, abbreviated IIS, Internet Information Services)
- typescript39-class类的可见修饰符
- 反射注解基础
猜你喜欢
Installation of Apache DolphinScheduler version 2.0.5 distributed cluster
数字孪生园区场景中的坐标知识
PotPlayer实现上班摸鱼电视自由
typescript40-class类的保护修饰符
Object类与常用API
Redis常用命令
Power button 561. An array of split
web安全-PHP反序列化漏洞
【HMS core】【Ads Kit】Huawei Advertising——Overseas applications are tested in China. Official advertisements cannot be displayed
idea使用@Autowired注解爆红原因及解决方法
随机推荐
NotImplementedError: file structure not yet supported
反射注解基础
Odps temporary query can write SQL, turned out to a named?
VR全景展打造专属元宇宙观展空间
Talking about GIS Data (6) - Projected Coordinate System
1054 求平均值 (20 分)
Flask的简单介绍及使用方法简介
接口和抽象
力扣561. 数组拆分
FileZilla 搭建ftp服务器
设计模式——组合模式、享元模式(Integer缓存)(结构型模式)
tag单调栈-单调栈预备知识-lt.739. 每日温度
4.如何避免缓存穿透、缓存击穿、缓存雪崩
Peptides mediated PEG DSPE of phospholipids, targeted functional materials - PEG - RGD/TAT/NGR/APRPG
Tributyl-mercaptophosphane "tBuBrettPhos Pd(allyl)" OTf), 1798782-17-8
Common lipophilic cell membrane dyes DiO, Dil, DiR, Did spectrograms and experimental procedures
CAD有生僻字如何打出来、如何提交软件相关问题或建议?
Apache DolphinScheduler版本2.0.5分布式集群的安装
Interface testing framework of actual combat (2) | interface request assertion
Detailed explanation of MOSN reverse channel