幸运数字c语言编程软件,关于c ++:幸运数字程序(4、7、44、47、74、77、444等)

Some numbers can be made by summing up the”LUCKY Numbers”.

(LUCKY Numbers consists of only”4″ and”7″. ex 4, 7, 44, 47, 74, 77, 444, 447, 474, … )

When N is given, write a program that prints the LUCKY Numbers which a sum of N.

If there are several method, print smaller numbers of one.

(ex. when N is 28, 28 = 7 + 7 + 7 + 7 OR 28 = 4 + 4 + 4 + 4 + 4 + 4 + 4)

but smaller numbers of LUCKY Numbers is 7 + 7 + 7 + 7.

If there are several methods, output lexicographically the most preceding one.

(ex. when N is 11, 11 = 4 + 7 OR 7 + 4)

but lexicographically preceding LUCKY Numbers is 4 + 7.

If N is not expressible as the sum of LUCKY Numbers, output -1.

(ex. when N is 10, 10 is not represented using LUCKY Numbers.)

文章知识点与官方知识档案匹配,可进一步学习相关知识C技能树首页概览114810 人正在系统学习中 相关资源:临时文件-细说php精要版,完整扫描版-管理软件文档类资源-CSDN文库

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年4月16日
下一篇 2021年4月16日

相关推荐