avatar
I*A
1
for any integer x between 1 to 27
find 3 numbers from (0 ..9) and the sum of them equals x.
the 3 numbers need not be distinct
for instance, 5+5+5=x
avatar
r*o
2
for i=0..9
for j=0..9
if 0有更好的方法吗?

【在 I**A 的大作中提到】
: for any integer x between 1 to 27
: find 3 numbers from (0 ..9) and the sum of them equals x.
: the 3 numbers need not be distinct
: for instance, 5+5+5=x

avatar
s*t
3
我好像又没看清题就写了一堆东西。我删掉了呵呵。
avatar
s*t
4
看刚才某个题目有感:
如果只要给一个答案: 查表!

【在 r****o 的大作中提到】
: for i=0..9
: for j=0..9
: if 0: 有更好的方法吗?

avatar
I*A
5
赞,你这个很好了,2700嘛才!

【在 r****o 的大作中提到】
: for i=0..9
: for j=0..9
: if 0: 有更好的方法吗?

avatar
g*1
6
先把数除3,遍历result1 to 9,然后这个过程中,把(total- count)/2,遍历
result2 to count.也就是说,先确定最大的数的范围,然后确定其次大的数的范围,
然后随便遍历一下,就都出来了,可以把结果存在一个2维数组里面。
avatar
I*A
7
写程序写程序。。

【在 g**********1 的大作中提到】
: 先把数除3,遍历result1 to 9,然后这个过程中,把(total- count)/2,遍历
: result2 to count.也就是说,先确定最大的数的范围,然后确定其次大的数的范围,
: 然后随便遍历一下,就都出来了,可以把结果存在一个2维数组里面。

avatar
s*t
8
你们不觉得1-27这个范围太小么
表格:
1: 0, 0, 1
2: 0, 1, 1
3: 1,1,1
4: 1,1,2
5, 1, 1,3
6, 1, 1,4
。。。。。
27, 9,9,9

【在 I**A 的大作中提到】
: 写程序写程序。。
avatar
I*A
9
童鞋,是从0-9,0呢?0呢?

【在 s******t 的大作中提到】
: 你们不觉得1-27这个范围太小么
: 表格:
: 1: 0, 0, 1
: 2: 0, 1, 1
: 3: 1,1,1
: 4: 1,1,2
: 5, 1, 1,3
: 6, 1, 1,4
: 。。。。。
: 27, 9,9,9

avatar
s*t
10
faint。我该睡觉了。我洗洗睡了

【在 I**A 的大作中提到】
: 童鞋,是从0-9,0呢?0呢?
avatar
I*A
11
wave~~~

【在 s******t 的大作中提到】
: faint。我该睡觉了。我洗洗睡了
avatar
m*n
12
可不可以递归?然后用一个global的数组?

【在 I**A 的大作中提到】
: for any integer x between 1 to 27
: find 3 numbers from (0 ..9) and the sum of them equals x.
: the 3 numbers need not be distinct
: for instance, 5+5+5=x

avatar
s*t
13
随便举个例子。
18 = 9+9+0
18 = 9+8+1
18 = 9+7+2
题目的要求是什么,是需要listout每个可能性么?
avatar
g*t
14
print x/3, (x+1)/3, (x+2)/3
avatar
I*A
15
nod, all combination
the original question is this one
"Find all numbers in the range 1...999999, where the sum of first 3 digits are same as last three digits"

【在 s******t 的大作中提到】
: 随便举个例子。
: 18 = 9+9+0
: 18 = 9+8+1
: 18 = 9+7+2
: 题目的要求是什么,是需要listout每个可能性么?

avatar
I*A
16
请问大家
这道题
除了分解1-27之间任何一个数成三个数(0-9)之外
有没有别的好办法?

are same as last three digits"

【在 I**A 的大作中提到】
: nod, all combination
: the original question is this one
: "Find all numbers in the range 1...999999, where the sum of first 3 digits are same as last three digits"

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。