当前位置:网站首页>邮资范围(数组 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);
}
}
边栏推荐
- Openssl--- stack
- Temperature acquisition experiment and experimental experience based on I2C
- Pytorch deep learning practice-b station Liu erden-day6
- Wu Enda machine learning chapter 1-2
- No application for domain name SSL certificate under ports 80 and 443 (applicable to acme.sh and certbot)
- [jmeter] TCP Sampler
- 【自动化测试】——robotframework实战(二)新建测试用例
- Release nohup Out disk space occupied
- Query of database (II)
- Cygwin cooperates with listary to switch the current directory and quickly open it
猜你喜欢

Wu Enda machine learning chapter 6-7

2019cs brand sdnand and EMMC selection comparison important analysis

Introduction to daily use of manjaro system

Hand in hand building a home NAS universal server (1) | configuration selection and preparation

5-17 hidden student services of Shaanxi University of science and technology

高并发day04(ZAB协议,观察者,nc,AVRO,RPC)

Relevant knowledge points of Gugao motion control card

Spot detection record

Machine learning - classification prediction of logistic regression

基于Ardunio IDE软件开发编程学习
随机推荐
Introduction to daily use of manjaro system
TCP/IP协议学习
释放nohup.out占用的磁盘空间
mass data
University
锁
Information on successful cooperation between CS brand sdnand and stm32mcu
NAND nor flash flash flash product overview
汉诺塔2(函数)
Causes and solutions of over fitting
明明爱喝水
Share the successful cooperation between CS brand sdnand and wearable devices
sql的约束条件
Programming learning based on ardunio ide software development
Part of the second Shanxi Network Security Skills Competition (Enterprise Group) WP (IV)
小迪网络安全笔记-信息收集-架构、搭建、waf(8)
阿拉伯数字转中文
Release nohup Out disk space occupied
Generate audio and waveform in PWM and DAC exercises of stm32
《PyTorch深度学习实践》-B站 刘二大人-day4