Cody

# Problem 1870. GJam:2013 World B: MAD Drummer

Solution 318042

Submitted on 12 Sep 2013 by Alfonso Nieto-Castanon
• Size: 35
• 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
%% tic v=[10 70 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

2   Pass
%% v=[0 10 19 30 ]; exp=0.5000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

3   Pass
%% v=[2 5 10 15 20 24 ]; exp=0.7500000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

4   Pass
%% v=[60 62 63 65 67 68 ]; exp=0.3333333; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

5   Pass
%% v=[0 1 4 9 16 17 24 29 32 33 ]; exp=2.1428571; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

6   Pass
%% v=[0 3 8 10 18 29 36 43 46 62 ]; exp=5.3333333; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

7   Pass
%% v=[2 5 7 10 12 15 17 23 24 27 ]; exp=1.5000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

8   Pass
%% v=[0 3 8 12 14 19 28 30 31 32 ]; exp=3.4375000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

9   Pass
%% v=[0 1 4 9 16 25 36 49 64 81 ]; exp=10.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

10   Pass
%% v=[0 3 8 12 22 28 38 59 77 80 ]; exp=10.0625000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

11   Pass
%% v=[31 37 41 47 ]; exp=0.5000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

12   Pass
%% v=[0 1 2 3 87 95 96 98 99 100 ]; exp=33.9166667; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

13   Pass
%% v=[8 13 15 20 26 ]; exp=1.1666667; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

14   Pass
%% v=[49 50 51 52 53 54 55 56 57 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

15   Pass
%% v=[94 95 96 97 98 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

16   Pass
%% v=[49 50 56 63 73 ]; exp=2.5000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

17   Pass
%% v=[3 9 11 14 16 24 29 32 34 39 ]; exp=2.5000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

18   Pass
%% v=[64 66 68 69 ]; exp=0.3333333; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

19   Pass
%% v=[2 6 9 14 21 73 84 87 90 99 ]; exp=18.9000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

20   Pass
%% v=[48 49 50 52 53 55 56 57 59 ]; exp=0.4000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

21   Pass
%% v=[22 23 24 27 30 ]; exp=1.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

22   Pass
%% v=[16 17 22 27 29 30 35 36 39 42 ]; exp=1.8750000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

23   Pass
%% v=[22 23 24 25 26 27 28 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

24   Pass
%% v=[16 18 21 22 24 27 29 31 ]; exp=0.5000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

25   Pass
%% v=[0 100 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

26   Pass
%% v=[62 63 64 65 66 67 68 69 70 71 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

27   Pass
%% v=[12 17 21 22 26 31 ]; exp=1.1666667; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

28   Pass
%% v=[86 87 88 89 90 91 92 93 94 95 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

29   Pass
%% v=[3 11 19 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

30   Pass
%% v=[59 60 63 66 68 70 ]; exp=0.6666667; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

31   Pass
%% v=[78 81 83 ]; exp=0.2500000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

32   Pass
%% v=[49 51 53 54 56 57 59 ]; exp=0.4000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

33   Pass
%% v=[5 10 14 19 21 26 27 30 32 33 ]; exp=2.7222222; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

34   Pass
%% v=[0 2 3 15 18 23 47 49 74 75 ]; exp=11.6250000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

35   Pass
%% v=[33 36 46 54 56 58 ]; exp=3.5000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

36   Pass
%% v=[0 3 6 11 13 23 28 31 32 33 ]; exp=3.5000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

37   Pass
%% v=[62 68 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

38   Pass
%% v=[49 50 51 52 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

39   Pass
%% v=[60 62 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

40   Pass
%% v=[60 63 67 70 72 73 76 ]; exp=1.1000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

41   Pass
%% v=[90 91 92 93 94 95 96 97 98 99 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

42   Pass
%% v=[37 41 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

43   Pass
%% v=[0 2 3 5 9 13 14 20 21 27 ]; exp=2.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

44   Pass
%% v=[0 1 2 3 86 87 92 98 99 100 ]; exp=33.4166667; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

45   Pass
%% v=[80 84 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

46   Pass
%% v=[3 5 8 12 67 81 88 90 95 97 ]; exp=20.4166667; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

47   Pass
%% v=[49 70 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

48   Pass
%% v=[0 49 100 ]; exp=0.5000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

49   Pass
%% v=[87 88 89 90 91 92 93 94 95 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

50   Pass
%% v=[6 8 14 15 18 24 29 33 37 40 ]; exp=1.8333333; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

51   Pass
%% v=[1 2 5 6 9 11 12 14 15 16 ]; exp=1.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

52   Pass
%% v=[39 42 46 54 61 66 74 ]; exp=2.3333333; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

53   Pass
%% v=[0 1 2 3 4 96 97 98 99 100 ]; exp=36.4000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

54   Pass
%% v=[73 74 75 76 77 78 79 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

55   Pass
%% v=[0 1 6 13 14 23 24 27 30 33 ]; exp=3.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

56   Pass
%% v=[57 58 59 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

57   Pass
%% v=[81 82 83 84 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

58   Pass
%% v=[89 91 92 94 ]; exp=0.2500000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

59   Pass
%% v=[0 3 5 13 15 17 23 28 29 33 ]; exp=2.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

60   Pass
%% v=[33 34 35 36 37 38 39 40 41 42 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

61   Pass
%% v=[72 73 74 75 76 77 78 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

62   Pass
%% v=[75 76 77 78 79 80 81 82 83 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

63   Pass
%% v=[0 4 8 12 16 20 24 28 32 36 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

64   Pass
%% v=[0 3 5 6 12 16 18 20 25 26 ]; exp=1.8000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

65   Pass
%% v=[24 30 36 42 43 45 49 54 56 60 ]; exp=3.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

66   Pass
%% v=[39 40 45 47 ]; exp=1.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

67   Pass
%% v=[1 6 7 11 18 19 20 24 29 35 ]; exp=2.4000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

68   Pass
%% v=[52 53 55 56 57 58 59 60 62 63 ]; exp=0.4166667; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

69   Pass
%% v=[24 35 42 47 ]; exp=1.6666667; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

70   Pass
%% v=[65 67 68 69 70 71 73 75 76 ]; exp=0.6666667; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

71   Pass
%% v=[0 1 3 9 16 26 44 49 61 81 ]; exp=10.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

72   Pass
%% v=[6 9 12 13 15 16 17 ]; exp=1.1666667; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

73   Pass
%% v=[0 1 5 13 22 25 31 34 44 49 ]; exp=3.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

74   Pass
%% v=[7 13 24 25 46 57 62 66 88 89 ]; exp=6.1875000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

75   Pass
%% v=[92 94 96 98 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

76   Pass
%% v=[0 1 2 3 5 6 8 ]; exp=0.5000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

77   Pass
%% v=[84 85 86 87 88 89 90 91 92 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

78   Pass
%% v=[1 5 6 9 58 77 87 96 98 100 ]; exp=18.8333333; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

79   Pass
%% v=[7 13 15 20 21 26 29 35 39 44 ]; exp=1.8125000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

80   Pass
%% v=[0 51 100 ]; exp=0.5000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

81   Pass
%% v=[18 22 23 ]; exp=0.7500000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

82   Pass
%% v=[35 36 37 38 39 40 41 42 43 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

83   Pass
%% v=[1 2 4 5 60 87 93 97 99 100 ]; exp=25.1666667; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

84   Pass
%% v=[0 10 20 30 40 50 60 70 80 90 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

85   Pass
%% v=[72 73 75 77 78 79 ]; exp=0.5000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

86   Pass
%% v=[87 88 89 90 91 92 93 94 95 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

87   Pass
%% v=[12 13 14 16 18 20 24 26 ]; exp=1.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

88   Pass
%% v=[59 64 66 68 70 ]; exp=1.1250000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

89   Pass
%% v=[46 57 67 ]; exp=0.2500000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

90   Pass
%% v=[0 9 13 16 17 22 27 38 43 45 ]; exp=3.2857143; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

91   Pass
%% v=[35 38 40 45 48 51 56 61 66 ]; exp=1.6875000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

92   Pass
%% v=[0 3 6 9 12 88 91 94 97 100 ]; exp=29.2000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

93   Pass
%% v=[0 3 4 ]; exp=0.5000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

94   Pass
%% v=[63 68 70 73 77 ]; exp=0.8333333; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

95   Pass
%% v=[18 26 36 39 42 43 ]; exp=4.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

96   Pass
%% v=[8 9 14 19 23 25 32 36 37 ]; exp=1.5000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

97   Pass
%% v=[11 15 17 22 ]; exp=0.7500000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

98   Pass
%% v=[43 45 47 50 54 58 60 61 65 66 ]; exp=1.4285714; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

99   Pass
%% v=[18 19 20 21 22 23 24 ]; exp=0.0000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6)

``` ```

100   Pass
%% v=[39 44 47 ]; exp=0.5000000; MAD=Drummer(v); assert(abs(MAD-exp)<2e-6) toc

```Elapsed time is 3.738396 seconds. ```