当前位置:网站首页>阿凡提的难题
阿凡提的难题
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';
}
}
}
边栏推荐
- Shell conditional statement judgment
- Interface test Mock combat (2) | Combined with jq to complete batch manual Mock
- 1059 C语言竞赛 (20 分)(C语言)
- 信息编码、存储压缩与密码学
- 1079 延迟的回文数 (20 分)
- Two ways to simulate multi-user login in Jmeter
- Junit
- Tributyl-mercaptophosphane "tBuBrettPhos Pd(allyl)" OTf), 1798782-17-8
- Redis6学习笔记
- Secondary development of WinForm controls
猜你喜欢
随机推荐
web安全-PHP反序列化漏洞
Install IIS services (Internet Information Services (Internet Information Services, abbreviated IIS, Internet Information Services)
HarmonyOS应用开发第一次培训
web安全-SSTI模板注入漏洞
Djiango第二次培训
1094 谷歌的招聘 (20 分)
Exception (abnormal) and Error (error) difference analysis
【特征选取】计算数据点曲率
Ali cloud object storage oss private barrels to generate links
斐讯K2路由编译Padavan华硕固件和心得
数据分析 第一篇
在树莓派上搭建属于自己的网页(1)
高效率科研神器——小软件、大能量
Exception(异常) 和 Error(错误)区别解析
Practical application of WebSocket
typescript46-函数之间的类型兼容性
初步认识ZK
4.如何避免缓存穿透、缓存击穿、缓存雪崩
【HMS core】【Ads Kit】Huawei Advertising——Overseas applications are tested in China. Official advertisements cannot be displayed
[Harmony OS] [ArkUI] ets development graphics and animation drawing









