问题33.创建时间表
Solution Stats
Problem Comments
-
24 Comments
Cześć
it would seem that the recently added test#2 is incorrectly defined
Agree with Mr.Alfonso ; Test#2 is incorrectly defined
Agree with Mr.Alfonso ; Test#2 is incorrectly defined
Agree with Mr.Alfonso ; Test#2 is incorrectly defined
Agree with Mr.Alfonso ; Test#2 is incorrectly defined
Apparently the Cody Team can't make a times table. :-p
Agree with the above
For those who wish to solve anyway: Make a correct solution that works with tests 1 and 3, and then hardcode an if with n==3 at the end to make solution 2 work
Sorry for the typo, I just fixed the test#2.
Good question!
How can people solve problem like this with a size 10 ?
Easy one
Easy one!
For a simple solution check out the matlab function kron
1
好的question
好的
good for beginners
why do you guys say nice question
so many possible solutions, just boils down to simplicity or creativity
Good problem!
Can be done in one line of code.
Interesting Problem
Solution Comments
-
2 Comments
good problem
I agree
-
1 Comment
moderately easy nice.
-
1 Comment
Challenging
-
1 Comment
That one was unique
-
1 Comment
m = [1:n]'*[1:n];
-
1 Comment
K = kron(1:n,1:n)
m = reshape(K,n,n)
-
1 Comment
Good Problem
-
5 Comments
function m = timestables(n)
y(1,1:n)=1:n;
y(1:n,1)=1:n;
对于i = 2:n
j = 2:n
y(i,j)=y(1,j)*y(i,1)
end
end
m = y;
end
a = repmat(1:n, n, 1);
m = a .* a';
or
m =(1:n)。*(1:n)';
m =(1:n)'*(1:n);
m = [1:n]'*[1:n];
what is the true leading solution?
谢谢道格
-
4条评论
Please help me out,cant find out the error
I think the error is pretty clear. line3: column=1:1:n; line4:row=1:1:n.
besides, 1:n just fine, the "1" in the middle is quite not necessary.
如果我使用1:n和1:1:n?两者都是相同的呢?两种情况的步长为1。尝试了您所说的话,但试件再次失败
two equal sign in line 3&4 are missed: this is fatal error, fix that, in my computer seems work fine. and 1:n is another problem, it can pass even you don't change it. nontheless, 1 in the middle is redundant. it CAN be removed, not like you have to.
-
2 Comments
你怎么能解决这个10码?
hahahaha,hello~~
-
1 Comment
very easy
-
1 Comment
好的
-
1 Comment
On my matlab this code works for all the test, but here it fails, why?
m = reshape(1:n^2,[n,n])';
此外,我如何才能看到我解决的问题的更好解决方案,以提高我的M万博 尤文图斯ATLAB技能?
Thank you very much for your attention
-
1 Comment
Sorry, I missed a ;-)
-
1 Comment
是的,我做到了。
-
1 Comment
Test solution 2 is incorrect, should be:
y_correct = [1 2 3; 2 4 6; 3 6 9]
current solution isn't even square...
-
1 Comment
The test suite is broken for this problem.
-
1 Comment
The second test should say y_correct = [1 2 3; 2 4 6;3 6 9];
-
2 Comments
can someone please tell me what I've done wrong here pls. Thanks
You've done nothing wrong; the solution to Test Suite #2 is incorrect.
-
1 Comment
No need to apply loop here, m=[1:n]'*[1:n] works fine.
function m = timestables(n)
m=(1:n)'*(1:n);
end
-
1 Comment
test # 2 is wrong, as it should be a 3x3 matrix,
y_correct for x=3 is:
[1 2 3; 2 4 6; 3 6 9]
-
1 Comment
Test nr. 2 seems not right: the soluton for x= 3 should be:
y_correct = [1 2 3; 2 4 6; 3 6 9]
-
1 Comment
lol
-
1 Comment
我尝试了MATLAB,它可以正常工作。
-
1 Comment
this solution is correct... the answer for test #2 is incorrect.
-
1 Comment
好问题。很好的提醒矢量乘法如何工作。
-
1 Comment
Good
-
1 Comment
Pretty Cool
-
2 Comments
Duh! Thanks for reminding me how matrix multiplication works
很好地学习矩阵标量乘法
-
1 Comment
it's correct for any value !!!!!
-
1 Comment
What, this is so weird!!!! Nice job
-
1 Comment
Missing semicolons...
-
1 Comment
l just wonder is it a real boring thing (times table),that we need to program it,for exam.12*12=144,almost everybody who atteded high school can answer,2^10=1024;25*25=625,13*13=169;14*14=196;15*15=225;it is such an easy thing that we needn't to make a table,we can calculate it out once we see such an multiplication
-
1 Comment
like your solution its very concise but there is one problem for me you have used '* for multiplication, can you please tell why?
-
1 Comment
function m = timestables(n)
for i=1:n
j = 1:n
m(i,j)=i*j;
end
end
%apparently this doesn't work even though MatLab says it works for any size
-
3 Comments
Brilliant!
After the solution I come up with ends up in the middle of the graph I feel disappointed. But then I learn there's a command that does something I didn't know about and I feel better about myself because I learned a new command!
amazing!
-
3 Comments
very elegant :)
好的:)
interesting approach, very smart!
Problem Recent Solvers12934
Suggested Problems
558个求解器
682 Solvers
Longest run of consecutive numbers
3639 Solvers
743 Solvers
11083求解器
更多的from this Author95
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
开始狩猎!