Cody

# Problem 44077. GJam 2017 Kickstart: Vote (Large)

Solution 1133158

Submitted on 3 Mar 2017 by James
• Size: 17
• 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
v=vote(821,455); assert(abs(v-0.286833856)<1e-8)

ans = 0.2868

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

ans = 0.3573

3   Pass
v=vote(858,291); assert(abs(v-0.493472585)<1e-8)

ans = 0.4935

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

ans = 0.9655

5   Pass
v=vote(1174,995); assert(abs(v-0.082526510)<1e-8)

ans = 0.0825

6   Pass
v=vote(1476,454); assert(abs(v-0.529533679)<1e-8)

ans = 0.5295

7   Pass
v=vote(690,333); assert(abs(v-0.348973607)<1e-8)

ans = 0.3490

8   Pass
v=vote(1230,896); assert(abs(v-0.157102540)<1e-8)

ans = 0.1571

9   Pass
v=vote(533,149); assert(abs(v-0.563049853)<1e-8)

ans = 0.5630

10   Pass
v=vote(1941,1758); assert(abs(v-0.049472830)<1e-8)

ans = 0.0495

11   Pass
v=vote(1976,339); assert(abs(v-0.707127430)<1e-8)

ans = 0.7071

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

ans = 1

13   Pass
v=vote(398,93); assert(abs(v-0.621181263)<1e-8)

ans = 0.6212

14   Pass
v=vote(1659,1028); assert(abs(v-0.234834388)<1e-8)

ans = 0.2348

15   Pass
v=vote(1894,961); assert(abs(v-0.326795096)<1e-8)

ans = 0.3268

16   Pass
v=vote(1388,874); assert(abs(v-0.227232538)<1e-8)

ans = 0.2272

17   Pass
v=vote(1354,1149); assert(abs(v-0.081901718)<1e-8)

ans = 0.0819

18   Pass
v=vote(1778,1287); assert(abs(v-0.160195759)<1e-8)

ans = 0.1602

19   Pass
v=vote(886,283); assert(abs(v-0.515825492)<1e-8)

ans = 0.5158

20   Pass
v=vote(1431,822); assert(abs(v-0.270306258)<1e-8)

ans = 0.2703

21   Pass
v=vote(679,544); assert(abs(v-0.110384301)<1e-8)

ans = 0.1104

22   Pass
v=vote(1405,1150); assert(abs(v-0.099804305)<1e-8)

ans = 0.0998

23   Pass
v=vote(1228,379); assert(abs(v-0.528313628)<1e-8)

ans = 0.5283

24   Pass
v=vote(1607,1129); assert(abs(v-0.174707602)<1e-8)

ans = 0.1747

25   Pass
v=vote(1265,457); assert(abs(v-0.469221835)<1e-8)

ans = 0.4692

26   Pass
v=vote(1885,1572); assert(abs(v-0.090540931)<1e-8)

ans = 0.0905

27   Pass
v=vote(1451,1348); assert(abs(v-0.036798857)<1e-8)

ans = 0.0368

28   Pass
v=vote(1712,975); assert(abs(v-0.274283588)<1e-8)

ans = 0.2743

29   Pass
v=vote(921,494); assert(abs(v-0.301766784)<1e-8)

ans = 0.3018

30   Pass
v=vote(1966,354); assert(abs(v-0.694827586)<1e-8)

ans = 0.6948

31   Pass
v=vote(1299,536); assert(abs(v-0.415803815)<1e-8)

ans = 0.4158

32   Pass
v=vote(1872,874); assert(abs(v-0.363437728)<1e-8)

ans = 0.3634

33   Pass
v=vote(1831,1125); assert(abs(v-0.238836265)<1e-8)

ans = 0.2388

34   Pass
v=vote(1101,822); assert(abs(v-0.145085803)<1e-8)

ans = 0.1451

35   Pass
v=vote(1057,526); assert(abs(v-0.335439040)<1e-8)

ans = 0.3354

36   Pass
v=vote(1761,639); assert(abs(v-0.467500000)<1e-8)

ans = 0.4675

37   Pass
v=vote(1111,137); assert(abs(v-0.780448718)<1e-8)

ans = 0.7804

38   Pass
v=vote(445,425); assert(abs(v-0.022988506)<1e-8)

ans = 0.0230

39   Pass
v=vote(670,362); assert(abs(v-0.298449612)<1e-8)

ans = 0.2984

40   Pass
v=vote(1009,737); assert(abs(v-0.155784651)<1e-8)

ans = 0.1558

41   Pass
v=vote(2000,1); assert(abs(v-0.999000500)<1e-8)

ans = 0.9990

42   Pass
v=vote(1504,28); assert(abs(v-0.963446475)<1e-8)

ans = 0.9634

43   Pass
v=vote(1821,560); assert(abs(v-0.529609408)<1e-8)

ans = 0.5296

44   Pass
v=vote(1521,1373); assert(abs(v-0.051140290)<1e-8)

ans = 0.0511

45   Pass
v=vote(823,361); assert(abs(v-0.390202703)<1e-8)

ans = 0.3902

46   Pass
v=vote(836,140); assert(abs(v-0.713114754)<1e-8)

ans = 0.7131

47   Pass
v=vote(1763,1599); assert(abs(v-0.048780488)<1e-8)

ans = 0.0488

48   Pass
v=vote(1288,162); assert(abs(v-0.776551724)<1e-8)

ans = 0.7766

49   Pass
v=vote(417,357); assert(abs(v-0.077519380)<1e-8)

ans = 0.0775

50   Pass
v=vote(1020,122); assert(abs(v-0.786339755)<1e-8)

ans = 0.7863

51   Pass
v=vote(1617,1576); assert(abs(v-0.012840589)<1e-8)

ans = 0.0128

52   Pass
v=vote(1493,780); assert(abs(v-0.313682358)<1e-8)

ans = 0.3137

53   Pass
v=vote(1868,34); assert(abs(v-0.964248160)<1e-8)

ans = 0.9642

54   Pass
v=vote(1452,1240); assert(abs(v-0.078751857)<1e-8)

ans = 0.0788

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

ans = 0.3333

56   Pass
v=vote(584,242); assert(abs(v-0.414043584)<1e-8)

ans = 0.4140

57   Pass
v=vote(1610,1196); assert(abs(v-0.147540984)<1e-8)

ans = 0.1475

58   Pass
v=vote(1423,1296); assert(abs(v-0.046708349)<1e-8)

ans = 0.0467

59   Pass
v=vote(975,479); assert(abs(v-0.341127923)<1e-8)

ans = 0.3411

60   Pass
v=vote(1000,80); assert(abs(v-0.851851852)<1e-8)

ans = 0.8519

61   Pass
v=vote(1227,1035); assert(abs(v-0.084880637)<1e-8)

ans = 0.0849

62   Pass
v=vote(1812,260); assert(abs(v-0.749034749)<1e-8)

ans = 0.7490

63   Pass
v=vote(1875,1294); assert(abs(v-0.183338593)<1e-8)

ans = 0.1833

64   Pass
v=vote(1882,826); assert(abs(v-0.389955687)<1e-8)

ans = 0.3900

65   Pass
v=vote(1401,1348); assert(abs(v-0.019279738)<1e-8)

ans = 0.0193

66   Pass
v=vote(1449,494); assert(abs(v-0.491507977)<1e-8)

ans = 0.4915

67   Pass
v=vote(1807,512); assert(abs(v-0.558430358)<1e-8)

ans = 0.5584

68   Pass
v=vote(1118,432); assert(abs(v-0.442580645)<1e-8)

ans = 0.4426

69   Pass
v=vote(1168,184); assert(abs(v-0.727810651)<1e-8)

ans = 0.7278

70   Pass
v=vote(1421,980); assert(abs(v-0.183673469)<1e-8)

ans = 0.1837

71   Pass
v=vote(1265,270); assert(abs(v-0.648208469)<1e-8)

ans = 0.6482

72   Pass
v=vote(1474,1172); assert(abs(v-0.114134543)<1e-8)

ans = 0.1141

73   Pass
v=vote(606,556); assert(abs(v-0.043029260)<1e-8)

ans = 0.0430

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

ans = 1

75   Pass
v=vote(1543,124); assert(abs(v-0.851229754)<1e-8)

ans = 0.8512

76   Pass
v=vote(1935,1383); assert(abs(v-0.166365280)<1e-8)

ans = 0.1664

77   Pass
v=vote(1969,1150); assert(abs(v-0.262584162)<1e-8)

ans = 0.2626

78   Pass
v=vote(1394,1223); assert(abs(v-0.065341995)<1e-8)

ans = 0.0653

79   Pass
v=vote(961,203); assert(abs(v-0.651202749)<1e-8)

ans = 0.6512

80   Pass
v=vote(1453,318); assert(abs(v-0.640880858)<1e-8)

ans = 0.6409

81   Pass
v=vote(1979,818); assert(abs(v-0.415087594)<1e-8)

ans = 0.4151

82   Pass
v=vote(333,302); assert(abs(v-0.048818898)<1e-8)

ans = 0.0488

83   Pass
v=vote(1830,1041); assert(abs(v-0.274817137)<1e-8)

ans = 0.2748

84   Pass
v=vote(1163,620); assert(abs(v-0.304542905)<1e-8)

ans = 0.3045

85   Pass
v=vote(1446,514); assert(abs(v-0.475510204)<1e-8)

ans = 0.4755

86   Pass
v=vote(1229,1116); assert(abs(v-0.048187633)<1e-8)

ans = 0.0482

87   Pass
v=vote(1590,1215); assert(abs(v-0.133689840)<1e-8)

ans = 0.1337

88   Pass
v=vote(990,252); assert(abs(v-0.594202899)<1e-8)

ans = 0.5942

89   Pass
v=vote(948,918); assert(abs(v-0.016077170)<1e-8)

ans = 0.0161

90   Pass
v=vote(2000,1999); assert(abs(v-0.000250063)<1e-8)

ans = 2.5006e-04

91   Pass
v=vote(1077,717); assert(abs(v-0.200668896)<1e-8)

ans = 0.2007

92   Pass
v=vote(1296,801); assert(abs(v-0.236051502)<1e-8)

ans = 0.2361

93   Pass
v=vote(1807,370); assert(abs(v-0.660082683)<1e-8)

ans = 0.6601

94   Pass
v=vote(253,218); assert(abs(v-0.074309979)<1e-8)

ans = 0.0743

95   Pass
v=vote(789,452); assert(abs(v-0.271555197)<1e-8)

ans = 0.2716

96   Pass
v=vote(1647,203); assert(abs(v-0.780540541)<1e-8)

ans = 0.7805

97   Pass
v=vote(1807,15); assert(abs(v-0.983534577)<1e-8)

ans = 0.9835

98   Pass
v=vote(1503,929); assert(abs(v-0.236019737)<1e-8)

ans = 0.2360

99   Pass
v=vote(1111,266); assert(abs(v-0.613652869)<1e-8)

ans = 0.6137

100   Pass
v=vote(1534,564); assert(abs(v-0.462345091)<1e-8)

ans = 0.4623

### Community Treasure Hunt

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

Start Hunting!