Cody

Problem 1959. German tank problem

Solution 2758042

Submitted on 30 Jul 2020 by Dennis Gimlin
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
Ntest=1e4; N=randi([10,100],Ntest,1); K=randi([1 10],Ntest,1); M=arrayfun(@(N,K)max(randi(N,1,K)),N,K); N_hat=arrayfun(@tank_problem,K,M); rate=mean(N==N_hat); assert(rate>=.1,sprintf('hit rate too low (%0.2f%%)',rate*100)); fprintf('hit rate = %0.2f%%\n',rate*100);

[Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits] [> In nchoosek (line 92) In tank_problem (line 20) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)] [Warning: Result may not be exact. Coefficient is greater than 9.00...

Suggested Problems

More from this Author38

Community Treasure Hunt

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

Start Hunting!