当前位置:网站首页>Postage range (array or + function)
Postage range (array or + function)
2022-07-19 06:53:00 【winkiii】
describe
We post letters with stamps , There are some small stamps at the post office , Through a combination of one or more of these small Stamps , It can meet the different postage of different mail . Now? , The post office has 4 Stamps of different denominations . The maximum number of stickers on each envelope is 5 A stamp , The face value can be the same , But it's different .
Input
The face value of four kinds of stamps .
Output
The postage consisting of these four denominations is the largest from 1 A continuous interval at the beginning .
explain : If the result is 10, Indicates the use of 4 Stamps can be combined into 1、2、3、4、5、6、7、8、9、10 These postage .
sample input 1
1 2 3 4
sample output 1
#include<stdio.h>
int main(){
int a,b,c,d;
scanf("%d %d %d %d",&a,&b,&c,&d);
int max=1;
int i,j,k,h;
int flag;
A:for(i=0;i<=5;i++){
for(j=0;j<=5-i;j++){
for(k=0;k<=5-i-j;k++){
for(h=0;h<=5-i-j-k;h++){
flag = 1;
if(a*i+b*j+c*k+d*h==max){
flag = 0;
max++;
goto A;
}
}
}
}
}
if(flag==1){
printf("%d.",max-1);
}
}
边栏推荐
猜你喜欢

Wu Enda machine learning chapter 6-7

Generate audio and waveform in PWM and DAC exercises of stm32

Galaxy Kirin server system building local and LAN Yum source

How can the new generation of CS sdnand (also known as patch T card) make the old MCU youthful

中国知网论文free下载的方法

Full experience of soft examination at the beginning, middle and advanced levels

Talk about Zhongtai: my understanding and thinking about Zhongtai

高并发day02(Concurrent包)

OLED data display based on spi/iic interface

Common user password encryption methods and cracking methods
随机推荐
Relevant knowledge points of Gugao motion control card
Homework
wireshark抓包:错误分析
高并发day04(ZAB协议,观察者,nc,AVRO,RPC)
Freebsd 12更换启动界面背景
企业数据治理之勒索病毒篇
Share the application cases of CS brand patch T card in the field of hunting camera
小迪-网络安全 笔记(1)
解决sonar的单元测试的覆盖率会为0问题
华为路由 端口映射
关于文件上传下载问题
F5LTM(一)逻辑关系图
使用Altium Designer软件绘制一个基于stm32设计
Temperature acquisition experiment and experimental experience based on I2C
Application case of CS brand sdnand in color detector industry
Wu Enda machine learning chapter 1-2
STM32的PWM和DAC练习中生成音频和波形
C language structure array pointer and function
day01(Flume)
Drawing PCB with Altium Designer