当前位置:网站首页>邮资范围(数组 or +函数)
邮资范围(数组 or +函数)
2022-07-17 05:21:00 【winkiii】
描述
我们寄信都要贴邮票,在邮局有一些小面值的邮票,通过这些小面值邮票中的一张或几张的组合,可以满足不同邮件的不同的邮资。 现在,邮局有4种不同面值的邮票。在每个信封上最多能贴5张邮票,面值可相同,可不同。
输入
四种邮票的面值。
输出
用这四种面值组成的邮资最大的从1开始的一个连续的区间。
说明:如结果为10,则表明使用4张邮票可组合出1、2、3、4、5、6、7、8、9、10这些邮资。
输入样例 1
1 2 3 4
输出样例 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);
}
}
边栏推荐
- STM32 serial communication related learning
- 什么是数据中台?
- Flip linked list
- Wu Enda machine learning chapter 10-11
- Experiment class II and object definition initialization
- Share the application cases of CS brand patch T card in the field of hunting camera
- SQL constraints
- ARM开发环境入门
- 小迪网络安全笔记-信息收集-架构、搭建、waf(8)
- 上课啦要点名啊
猜你喜欢

Share the application cases of CS brand patch T card in the field of hunting camera

基于Ardunio IDE软件开发编程学习

day01(Flume)

Wu Enda machine learning chapter 8-9

Experiment 5: Gui

基于I2C的温度采集实验及实验心得

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

Application of views and index files

管理员阻止运行此应用

Pytorch deep learning practice-b station Liu erden-day5
随机推荐
简单irules编写 入门级
翻转链表
使用Altium Designer软件绘制一个基于stm32设计
F5LTM(一)逻辑关系图
Tcp/ip four layer model and related configurations of F5
【自动化测试】——robotframework实战(三)编写测试用例
STM32串口通信相关学习
X11 forwarding
redis
Binary search and its extension
Common user password encryption methods and cracking methods
2022-7-15 cheap domestic PLC industrial control board with scattered records of 485 master-slave communication
《PyTorch深度学习实践》-B站 刘二大人-day5
Tcp/ip protocol learning
华为路由 端口映射
渣渣学习之路(1)输出某年某月的日历页
Part of the second Shanxi Network Security Skills Competition (Enterprise Group) WP (IV)
Share the successful cooperation between CS brand sdnand and wearable devices
TCP/IP四层模型以及F5部分相关配置
高并发day01(NIO、ConCurrent包)