当前位置:网站首页>阿凡提的难题
阿凡提的难题
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';
}
}
}
边栏推荐
- 初步认识ZK
- Junit
- Tributyl-mercaptophosphane "tBuBrettPhos Pd(allyl)" OTf), 1798782-17-8
- CAD有生僻字如何打出来、如何提交软件相关问题或建议?
- odps的临时查询能在写sql的时候就给结果一个命名不?
- Secondary development of WinForm controls
- 安装IIS服务(Internet信息服务(Internet Information Services,简写IIS,互联网信息服务)
- 【 Harmony OS 】 【 ano UI 】 lightweight data storage
- Detailed explanation of MOSN reverse channel
- MCM box model modeling method and source analysis of atmospheric O3
猜你喜欢
Pr第四次培训笔记
High availability, two locations and three centers
PotPlayer实现上班摸鱼电视自由
Install IIS services (Internet Information Services (Internet Information Services, abbreviated IIS, Internet Information Services)
HarmonyOS应用开发第一次培训
MySql数据库
Talking about GIS Data (5) - Geographic Coordinate System
flask 面试题 问题
【Biotin Azide|cas:908007-17-0】Price_Manufacturer
Power button 561. An array of split
随机推荐
ss-1.curl (cloud-provider-payment8001)
Business table analysis - balance system
ss-2.子项目互相访问(order80 -> payment8001)
Peptides mediated PEG DSPE of phospholipids, targeted functional materials - PEG - RGD/TAT/NGR/APRPG
如何不耍流氓的做运维之-SHELL脚本
在树莓派上搭建属于自己的网页(2)
Lambda表达式案例
Interface Test Framework Practice (4) | Get Schema Assertion
Interface testing framework of actual combat (2) | interface request assertion
shell script loop statement
idea使用@Autowired注解爆红原因及解决方法
[Fine talk] Using native js to implement todolist
Flask Web 报错:
高可用 两地三中心
Apache DolphinScheduler版本2.0.5分布式集群的安装
Kaggle(四)Scikit-learn
Harmony OS Date ano UI 】 【 】 the basic operation
在树莓派上搭建属于自己的网页(1)
13.< tag-动态规划和回文字串>lt.647. 回文子串 + lt.516.最长回文子序列
GIS数据漫谈(五)— 地理坐标系统