当前位置:网站首页>阿凡提的难题
阿凡提的难题
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';
}
}
}
边栏推荐
猜你喜欢

MCM box model modeling method and source analysis of atmospheric O3

【HMS core】【Ads Kit】Huawei Advertising——Overseas applications are tested in China. Official advertisements cannot be displayed

Kaggle(四)Scikit-learn

Common fluorescent dyes to modify a variety of groups and its excitation and emission wavelength data in the data

数字孪生园区场景中的坐标知识

Object类与常用API

VR全景展打造专属元宇宙观展空间

Js学习笔记(四)

Install IIS services (Internet Information Services (Internet Information Services, abbreviated IIS, Internet Information Services)

typescript43-类型兼容性说明
随机推荐
Redis常用命令
Kaggle(四)Scikit-learn
Response 重写设置返回值
信息编码、存储压缩与密码学
Install IIS services (Internet Information Services (Internet Information Services, abbreviated IIS, Internet Information Services)
IO process thread -> thread -> day5
4.如何避免缓存穿透、缓存击穿、缓存雪崩
Junit
Shell conditional statement judgment
web安全-sql注入漏洞
Interface Test Framework Practice | Process Encapsulation and Test Case Design Based on Encrypted Interface
2022暑假牛客多校联赛第一场
安装IIS服务(Internet信息服务(Internet Information Services,简写IIS,互联网信息服务)
Harmony OS ets ArkUI 】 【 】 the development basic page layout and data connection
GIS数据漫谈(六)— 投影坐标系统
阿里云对象存储oss私有桶生成链接
【HMS core】【Ads Kit】Huawei Advertising——Overseas applications are tested in China. Official advertisements cannot be displayed
用户密码加密工具
建立树形结构
反射注解基础