Problem Comments
-
6 Comments
The test suite was broken, as many of you suspected. I fixed it and rescored the problems.
I like this problem:)
非常有趣的问题
Good
The test case 3 is totally wrong. It needs immediate correction. The code maker didn't notice that b=25 is a number not a single digit. If you're doing the sum of digits it always ends up with a single digit, it will never end up with number cause number itself is carrying multiple digits.
只是为了徽章;)
解决方案评论
-
2条评论
函数b = sumdigits(n)
pow=2^n;
b = 0;
而POW〜= 0
b = b+mod(POW,10);
pow=floor(pow/10);
结尾
结尾
The code is wrong. Cause the while doest have a stopping condition.
-
1条评论
This is cheating, you didn't even solve the problem, you just passed parameters to the test suite
-
2条评论
-
1条评论
直到我们强迫B成为INT8功能的整数之前,我们的计划才获得批准
-
1条评论
good job
-
1条评论
函数b = sumdigits(n)
%SUMDIGITS Given n, find the sum of the digits that make up 2^n
in = num2str(2^n);
b = sum(str2num(in(:)));
结尾
-
1条评论
该解决方案不涵盖N的整个范围。
-
1条评论
This codes gives expected result verified in matlab, dont know why it is considered as incorrect answer
-
1条评论
Clunky, but I'm happy ^_^
-
2条评论
Interesting problem. I guess it´s rarely applied.
great! learning the existence of arrayfun
-
1条评论
在QS中,传递变量为'n',在解决方案中是“ a”
-
3条评论
-
1条评论
This solution takes advantage of the fact that the ASCII character set is nicely ordered.
-
2条评论
Extremely clever! Why didn't I think of that!?
Great: to transpose a char row into a char column makes the work...
-
2条评论
How does this work?
这是预约,查找表。当输入变量来自小集合(以及计算长而硬)时,方法很常见。现在我认为这在这场比赛中是在作弊,对不起:]
-
2条评论
不错,但是该解决方案与总和> 47不起作用
因此,在mod和总和之间切换应该很好吗?
-
2条评论
please explain why the digits get separated when (num2str(2^n)-'0') is performed
NUM2STR将整数数字转换为该数字的字符串表示:1234变为'1234',与['1','2','3','4']相同。现在,您每个数字有一个阵列条目。从那里减去“ 0”,然后char阵列将变成一个双阵列,其中char为“ 0”,等等。
-
1条评论
Buggy
-
1条评论
如果n的数字加起来不到9,则只能起作用(显然),这对于当前的测试用例非常有用,但以后不会结束。
-
1条评论
这应该不起作用,因为您应该概括2^n的数字
Problem Recent Solvers6637
Suggested Problems
Back to basics 22 - Rotate a matrix
833 Solvers
3960求解器
306求解器
388 Solvers
Matlab Basics - y as a function of x
410 Solvers