找到这些模式逻辑 [英] Find these pattern logic

查看:58
本文介绍了找到这些模式逻辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家,

请帮我用C ++开发以下逻辑。

我必须找到三个数字组合的最小数字,其乘数为100。

例如1

(554)= 5X5X4 = 100

(455)= 4X5X5 = 100

(545)= 5X4X5 = 100

这里最少的数字是455.

例如2

(435)= 4X3X5 = 60

( 345)= 3X4X5 = 60

(534)= 5X3X4 = 60

这里最少的数字是345.

而不是100或60我们可以还有另一个数字,我拿这些数字只是为了举例。



如果是C#,请不要使用LINQ。

Hi Experts,
Please Help me develop below logic in C++.
I have to find smallest number in combination of three number whose multiplication is hundred.
e.g 1
(554)=5X5X4=100
(455)=4X5X5=100
(545)=5X4X5=100
Here least number is 455.
e.g 2
(435)=4X3X5=60
(345)=3X4X5=60
(534)=5X3X4=60
Here least number is 345.
instead of 100 or 60 we can also take another number I take these number just for example.

In case of C# please not used LINQ.

推荐答案

它是C ++还是C#;并不重要,因为逻辑完全一样。首先写下算法所需的步骤,例如

Which is it C++ or C#; not that it matters, since the logic is exactly the same. Start by writing down the steps needed for the algorithm, e.g.
Select next value
Split into single digits
Multiply together to check total
Check whether larger or smaller than previous value
Repeat


这篇关于找到这些模式逻辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆