Cody

Problem 45389. Knight's Watch

Solution 2197847

Submitted on 7 Apr 2020 by Nikolaos Nikolaou
  • Size: 99
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x =[1,1]; assert(isequal(knights_watch(x,3,2),0.0625))

s = 0.0625 prob = 0.0625

2   Pass
x =[1,1]; assert(isequal(knights_watch(x,4,4),0.0176))

s = 0.0176 prob = 0.0176

3   Pass
x =[6,4]; assert(isequal(knights_watch(x,6,9),0.012))

s = 0.0120 prob = 0.0120

4   Pass
x =[6,4]; assert(isequal(knights_watch(x,8,25),0.0011))

s = 0.0011 prob = 0.0011

5   Pass
x =[8,8]; assert(isequal(knights_watch(x,8,15),0.0042))

s = 0.0042 prob = 0.0042

6   Pass
x =[8,8]; assert(isequal(knights_watch(x,16,15),0.4666))

s = 0.4666 prob = 0.4666

7   Pass
x =[3,1]; assert(isequal(knights_watch(x,16,50),0.0037))

s = 0.0037 prob = 0.0037

Suggested Problems

More from this Author149

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!