Cody

# Problem 2482. Card Game

Solution 2843946

Submitted on 16 Aug 2020 by Kevin Molina
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
for i=1:randi(1000) vec = randperm(100); end vec = randperm(100); a = vec(1:50); % given to bot b = vec(51:100); % given to player you = 0; bot = 0; for i = 1:50 c = call(a(1),b); if ~ismember(c,b) while(1) end end if c>a(1) you = you + 1; else bot = bot + 1; end b(b==c)=[]; a(1)=[]; end if you<floor(50*0.75) while(1) disp('not enough wins'); end end

c = Columns 1 through 30 1 33 2 93 59 89 70 62 82 84 81 96 19 71 48 72 92 34 29 41 15 53 87 12 6 42 17 31 75 20 Columns 31 through 50 64 56 7 90 16 25 37 26 39 69 36 8 73 88 44 51 28 52 23 83 c = Columns 1 through 30 1 33 2 93 59 89 70 62 82 84 81 96 19 71 48 72 92 34 29 41 15 53 87 12 6 42 17 31 75 20 Columns 31 through 50 64 56 7 90 16 25 37 26 39 69 36 8 73 88 44 51 28 52 23 83 ic = 1 y = 3 c = Columns 1 through 30 34 3 94 60 90 71 63 83 85 82 97 20 72 49 73 93 35 30 42 16 54 88 13 7 43 18 32 76 21 65 Columns 31 through 49 57 8 91 17 26 38 27 40 70 37 9 74 89 45 52 29 53 24 84 c = Columns 1 through 30 34 3 94 60 90 71 63 83 85 82 97 20 72 49 73 93 35 30 42 16 54 88 13 7 43 18 32 76 21 65 Columns 31 through 49 57 8 91 17 26 38 27 40 70 37 9 74 89 45 52 29 53 24 84 ic = 2 y = 4 c = Columns 1 through 30 -14 46 12 42 23 15 35 37 34 49 -28 24 1 25 45 -13 -18 -6 -32 6 40 -35 -41 -5 -30 -16 28 -27 17 9 Columns 31 through 48 -40 43 -31 -22 -10 -21 -8 22 -11 -39 26 41 -3 4 -19 5 -24 36 c = Columns 1 through 30 100 46 12 42 23 15 35 37 34 49 100 24 1 25 45 100 100 100 100 6 40 100 100 100 100 100 28 100 17 9 Columns 31 through 48 100 43 100 100 100 100 100 22 100 100 26 41 100 4 100 5 100 36 ic = 13 y = 50 c = Columns 1 through 30 9 69 35 65 46 38 58 60 57 72 -5 47 48 68 10 5 17 -9 29 63 -12 -18 18 -7 7 51 -4 40 32 -17 Columns 31 through 47 66 -8 1 13 2 15 45 12 -16 49 64 20 27 4 28 -1 59 c = Columns 1 through 30 9 69 35 65 46 38 58 60 57 72 100 47 48 68 10 5 17 100 29 63 100 100 18 100 7 51 100 40 32 100 Columns 31 through 47 66 100 1 13 2 15 45 12 100 49 64 20 27 4 28 100 59 ic = 33 y = 27 c = Columns 1 through 30 6 66 32 62 43 35 55 57 54 69 -8 44 45 65 7 2 14 -12 26 60 -15 -21 15 -10 4 48 -7 37 29 -20 Columns 31 through 46 63 -11 10 -1 12 42 9 -19 46 61 17 24 1 25 -4 56 c = Columns 1 through 30 6 66 32 62 43 35 55 57 54 69 100 44 45 65 7 2 14 100 26 60 100 100 15 100 4 48 100 37 29 100 Columns 31 through 46 63 100 10 100 12 42 9 100 46 61 17 24 1 25 100 56 ic = 43 y = 30 c = Columns 1 through 30 23 83 49 79 60 52 72 74 71 86 9 61 62 82 24 19 31 5 43 77 2 -4 32 7 21 65 10 54 46 -3 Columns 31 through 45 80 6 27 16 29 59 26 -2 63 78 34 41 42 13 73 c = Columns 1 through 30 23 83 49 79 60 52 72 74 71 86 9 61 62 82 24 19 31 5 43 77 2 100 32 7 21 65 10 54 46 100 Columns 31 through 45 80 6 27 16 29 59 26 100 63 78 34 41 42 13 73 ic = 21 y = 14 c = Columns 1 through 30 28 88 54 84 65 57 77 79 76 91 14 66 67 87 29 24 36 10 48 82 1 37 12 26 70 15 59 51 2 85 Columns 31 through 44 11 32 21 34 64 31 3 68 83 39 46 47 18 78 c = Columns 1 through 30 28 88 54 84 65 57 77 79 76 91 14 66 67 87 29 24 36 10 48 82 1 37 12 26 70 15 59 51 2 85 Columns 31 through 44 11 32 21 34 64 31 3 68 83 39 46 47 18 78 ic = 21 y = 8 c = Columns 1 through 30 -43 17 -17 13 -6 -14 6 8 5 20 -57 -5 -4 16 -42 -47 -35 -61 -23 11 -34 -59 -45 -1 -56 -12 -20 -69 14 -60 Columns 31 through 43 -39 -50 -37 -7 -40 -68 -3 12 -32 -25 -24 -53 7 c = Columns 1 through 30 100 17 100 13 100 100 6 8 5 20 100 100 100 16 100 100 100 100 100 11 100 100 100 100 100 100 100 100 14 100 Columns 31 through 43 100 100 100 100 100 100 100 12 100 100 100 100 7 ic = 9 y = 83 c = Columns 1 through 30 -33 27 -7 23 4 -4 16 18 30 -47 5 6 26 -32 -37 -25 -51 -13 21 -24 -49 -35 9 -46 -2 -10 -59 24 -50 -29 Columns 31 through 42 -40 -27 3 -30 -58 7 22 -22 -15 -14 -43 17 c = Columns 1 through 30 100 27 100 23 4 100 16 18 30 100 5 6 26 100 100 100 100 100 21 100 100 100 9 100 100 100 100 24 100 100 Columns 31 through 42 100 100 3 100 100 7 22 100 100 100 100 17 ic = 33 y = 71 c = Columns 1 through 30 -17 43 9 39 20 12 32 34 46 -31 21 22 42 -16 -21 -9 -35 3 37 -8 -33 -19 25 -30 14 6 -43 40 -34 -13 Columns 31 through 41 -24 -11 -14 -42 23 38 -6 1 2 -27 33 c = Columns 1 through 30 100 43 9 39 20 12 32 34 46 100 21 22 42 100 100 100 100 3 37 100 100 100 25 100 14 6 100 40 100 100 Columns 31 through 41 100 100 100 100 23 38 100 1 2 100 33 ic = 38 y = 53 c = Columns 1 through 30 -53 7 -27 3 -16 -24 -4 -2 10 -67 -15 -14 6 -52 -57 -45 -71 -33 1 -44 -69 -55 -11 -66 -22 -30 -79 4 -70 -49 Columns 31 through 40 -60 -47 -50 -78 -13 2 -42 -34 -63 -3 c = Columns 1 through 30 100 7 100 3 100 100 100 100 10 100 100 100 6 100 100 100 100 100 1 100 100 100 100 100 100 100 100 4 100 100 Columns 31 through 40 100 100 100 100 100 2 100 100 100 100 ic = 19 y = 89 c = Columns 1 through 30 15 75 41 71 52 44 64 66 78 1 53 54 74 16 11 23 -3 35 24 -1 13 57 2 46 38 -11 72 -2 19 8 Columns 31 through 39 21 18 -10 55 70 26 34 5 65 c = Columns 1 through 30 15 75 41 71 52 44 64 66 78 1 53 54 74 16 11 23 100 35 24 100 13 57 2 46 38 100 72 100 19 8 Columns 31 through 39 21 18 100 55 70 26 34 5 65 ic = 10 y = 21 c = Columns 1 through 30 -62 -2 -36 -6 -25 -33 -13 -11 1 -24 -23 -3 -61 -66 -54 -80 -42 -53 -78 -64 -20 -75 -31 -39 -88 -5 -79 -58 -69 -56 Columns 31 through 38 -59 -87 -22 -7 -51 -43 -72 -12 c = Columns 1 through 30 100 100 100 100 100 100 100 100 1 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 Columns 31 through 38 100 100 100 100 100 100 100 100 ic = 9 y = 98 c = Columns 1 through 30 30 90 56 86 67 59 79 81 68 69 89 31 26 38 12 50 39 14 28 72 17 61 53 4 87 13 34 23 36 33 Columns 31 through 37 5 70 85 41 49 20 80 c = Columns 1 through 30 30 90 56 86 67 59 79 81 68 69 89 31 26 38 12 50 39 14 28 72 17 61 53 4 87 13 34 23 36 33 Columns 31 through 37 5 70 85 41 49 20 80 ic = 24 y = 9 c = Columns 1 through 30 19 79 45 75 56 48 68 70 57 58 78 20 15 27 1 39 28 3 17 61 6 50 42 76 2 23 12 25 22 -6 Columns 31 through 36 59 74 30 38 9 69 c = Columns 1 through 30 19 79 45 75 56 48 68 70 57 58 78 20 15 27 1 39 28 3 17 61 6 50 42 76 2 23 12 25 22 100 Columns 31 through 36 59 74 30 38 9 69 ic = 15 y = 17 c = Columns 1 through 30 -44 16 -18 12 ...

### Community Treasure Hunt

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

Start Hunting!