Cody

Problem 44076. GJam 2017 Kickstart: Vote (Small)

Solution 1133157

Submitted on 3 Mar 2017 by James
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
v=vote(10,7); assert(abs(v-0.176470588)<1e-8)

ans = 0.1765

2   Pass
v=vote(9,2); assert(abs(v-0.636363636)<1e-8)

ans = 0.6364

3   Pass
v=vote(6,4); assert(abs(v-0.200000000)<1e-8)

ans = 0.2000

4   Pass
v=vote(3,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

5   Pass
v=vote(10,5); assert(abs(v-0.333333333)<1e-8)

ans = 0.3333

6   Pass
v=vote(6,2); assert(abs(v-0.500000000)<1e-8)

ans = 0.5000

7   Pass
v=vote(9,7); assert(abs(v-0.125000000)<1e-8)

ans = 0.1250

8   Pass
v=vote(8,2); assert(abs(v-0.600000000)<1e-8)

ans = 0.6000

9   Pass
v=vote(3,1); assert(abs(v-0.500000000)<1e-8)

ans = 0.5000

10   Pass
v=vote(6,5); assert(abs(v-0.090909091)<1e-8)

ans = 0.0909

11   Pass
v=vote(7,1); assert(abs(v-0.750000000)<1e-8)

ans = 0.7500

12   Pass
v=vote(6,1); assert(abs(v-0.714285714)<1e-8)

ans = 0.7143

13   Pass
v=vote(2,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

14   Pass
v=vote(4,1); assert(abs(v-0.600000000)<1e-8)

ans = 0.6000

15   Pass
v=vote(10,9); assert(abs(v-0.052631579)<1e-8)

ans = 0.0526

16   Pass
v=vote(7,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

17   Pass
v=vote(7,6); assert(abs(v-0.076923077)<1e-8)

ans = 0.0769

18   Pass
v=vote(3,1); assert(abs(v-0.500000000)<1e-8)

ans = 0.5000

19   Pass
v=vote(4,1); assert(abs(v-0.600000000)<1e-8)

ans = 0.6000

20   Pass
v=vote(8,6); assert(abs(v-0.142857143)<1e-8)

ans = 0.1429

21   Pass
v=vote(6,2); assert(abs(v-0.500000000)<1e-8)

ans = 0.5000

22   Pass
v=vote(8,3); assert(abs(v-0.454545455)<1e-8)

ans = 0.4545

23   Pass
v=vote(8,5); assert(abs(v-0.230769231)<1e-8)

ans = 0.2308

24   Pass
v=vote(8,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

25   Pass
v=vote(8,7); assert(abs(v-0.066666667)<1e-8)

ans = 0.0667

26   Pass
v=vote(8,6); assert(abs(v-0.142857143)<1e-8)

ans = 0.1429

27   Pass
v=vote(9,2); assert(abs(v-0.636363636)<1e-8)

ans = 0.6364

28   Pass
v=vote(10,4); assert(abs(v-0.428571429)<1e-8)

ans = 0.4286

29   Pass
v=vote(7,6); assert(abs(v-0.076923077)<1e-8)

ans = 0.0769

30   Pass
v=vote(9,3); assert(abs(v-0.500000000)<1e-8)

ans = 0.5000

31   Pass
v=vote(10,4); assert(abs(v-0.428571429)<1e-8)

ans = 0.4286

32   Pass
v=vote(10,5); assert(abs(v-0.333333333)<1e-8)

ans = 0.3333

33   Pass
v=vote(5,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

34   Pass
v=vote(8,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

35   Pass
v=vote(9,1); assert(abs(v-0.800000000)<1e-8)

ans = 0.8000

36   Pass
v=vote(3,1); assert(abs(v-0.500000000)<1e-8)

ans = 0.5000

37   Pass
v=vote(10,8); assert(abs(v-0.111111111)<1e-8)

ans = 0.1111

38   Pass
v=vote(7,4); assert(abs(v-0.272727273)<1e-8)

ans = 0.2727

39   Pass
v=vote(7,4); assert(abs(v-0.272727273)<1e-8)

ans = 0.2727

40   Pass
v=vote(4,1); assert(abs(v-0.600000000)<1e-8)

ans = 0.6000

41   Pass
v=vote(9,5); assert(abs(v-0.285714286)<1e-8)

ans = 0.2857

42   Pass
v=vote(3,2); assert(abs(v-0.200000000)<1e-8)

ans = 0.2000

43   Pass
v=vote(7,2); assert(abs(v-0.555555556)<1e-8)

ans = 0.5556

44   Pass
v=vote(5,2); assert(abs(v-0.428571429)<1e-8)

ans = 0.4286

45   Pass
v=vote(2,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

46   Pass
v=vote(5,3); assert(abs(v-0.250000000)<1e-8)

ans = 0.2500

47   Pass
v=vote(10,1); assert(abs(v-0.818181818)<1e-8)

ans = 0.8182

48   Pass
v=vote(8,6); assert(abs(v-0.142857143)<1e-8)

ans = 0.1429

49   Pass
v=vote(9,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

50   Pass
v=vote(10,7); assert(abs(v-0.176470588)<1e-8)

ans = 0.1765

51   Pass
v=vote(8,4); assert(abs(v-0.333333333)<1e-8)

ans = 0.3333

52   Pass
v=vote(2,1); assert(abs(v-0.333333333)<1e-8)

ans = 0.3333

53   Pass
v=vote(8,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

54   Pass
v=vote(8,6); assert(abs(v-0.142857143)<1e-8)

ans = 0.1429

55   Pass
v=vote(6,1); assert(abs(v-0.714285714)<1e-8)

ans = 0.7143

56   Pass
v=vote(8,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

57   Pass
v=vote(9,3); assert(abs(v-0.500000000)<1e-8)

ans = 0.5000

58   Pass
v=vote(7,6); assert(abs(v-0.076923077)<1e-8)

ans = 0.0769

59   Pass
v=vote(10,4); assert(abs(v-0.428571429)<1e-8)

ans = 0.4286

60   Pass
v=vote(5,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

61   Pass
v=vote(5,2); assert(abs(v-0.428571429)<1e-8)

ans = 0.4286

62   Pass
v=vote(10,1); assert(abs(v-0.818181818)<1e-8)

ans = 0.8182

63   Pass
v=vote(7,4); assert(abs(v-0.272727273)<1e-8)

ans = 0.2727

64   Pass
v=vote(6,2); assert(abs(v-0.500000000)<1e-8)

ans = 0.5000

65   Pass
v=vote(6,3); assert(abs(v-0.333333333)<1e-8)

ans = 0.3333

66   Pass
v=vote(4,3); assert(abs(v-0.142857143)<1e-8)

ans = 0.1429

67   Pass
v=vote(10,9); assert(abs(v-0.052631579)<1e-8)

ans = 0.0526

68   Pass
v=vote(10,6); assert(abs(v-0.250000000)<1e-8)

ans = 0.2500

69   Pass
v=vote(7,2); assert(abs(v-0.555555556)<1e-8)

ans = 0.5556

70   Pass
v=vote(9,5); assert(abs(v-0.285714286)<1e-8)

ans = 0.2857

71   Pass
v=vote(2,1); assert(abs(v-0.333333333)<1e-8)

ans = 0.3333

72   Pass
v=vote(8,4); assert(abs(v-0.333333333)<1e-8)

ans = 0.3333

73   Pass
v=vote(7,5); assert(abs(v-0.166666667)<1e-8)

ans = 0.1667

74   Pass
v=vote(10,6); assert(abs(v-0.250000000)<1e-8)

ans = 0.2500

75   Pass
v=vote(5,3); assert(abs(v-0.250000000)<1e-8)

ans = 0.2500

76   Pass
v=vote(10,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

77   Pass
v=vote(8,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

78   Pass
v=vote(4,2); assert(abs(v-0.333333333)<1e-8)

ans = 0.3333

79   Pass
v=vote(1,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

80   Pass
v=vote(8,6); assert(abs(v-0.142857143)<1e-8)

ans = 0.1429

81   Pass
v=vote(10,3); assert(abs(v-0.538461538)<1e-8)

ans = 0.5385

82   Pass
v=vote(4,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

83   Pass
v=vote(9,8); assert(abs(v-0.058823529)<1e-8)

ans = 0.0588

84   Pass
v=vote(6,5); assert(abs(v-0.090909091)<1e-8)

ans = 0.0909

85   Pass
v=vote(10,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

86   Pass
v=vote(7,2); assert(abs(v-0.555555556)<1e-8)

ans = 0.5556

87   Pass
v=vote(5,2); assert(abs(v-0.428571429)<1e-8)

ans = 0.4286

88   Pass
v=vote(5,1); assert(abs(v-0.666666667)<1e-8)

ans = 0.6667

89   Pass
v=vote(9,1); assert(abs(v-0.800000000)<1e-8)

ans = 0.8000

90   Pass
v=vote(5,1); assert(abs(v-0.666666667)<1e-8)

ans = 0.6667

91   Pass
v=vote(5,3); assert(abs(v-0.250000000)<1e-8)

ans = 0.2500

92   Pass
v=vote(6,4); assert(abs(v-0.200000000)<1e-8)

ans = 0.2000

93   Pass
v=vote(6,0); assert(abs(v-1.000000000)<1e-8)

ans = 1

94   Pass
v=vote(6,1); assert(abs(v-0.714285714)<1e-8)

ans = 0.7143

95   Pass
v=vote(4,2); assert(abs(v-0.333333333)<1e-8)

ans = 0.3333

96   Pass
v=vote(10,1); assert(abs(v-0.818181818)<1e-8)

ans = 0.8182

97   Pass
v=vote(7,6); assert(abs(v-0.076923077)<1e-8)

ans = 0.0769

98   Pass
v=vote(6,5); assert(abs(v-0.090909091)<1e-8)

ans = 0.0909

99   Pass
v=vote(5,4); assert(abs(v-0.111111111)<1e-8)

ans = 0.1111

100   Pass
v=vote(6,0); assert(abs(v-1.000000000)<1e-8)

ans = 1