Problem Statement
Alice likes making candy. Recently, she promised to make candy for all her classmates. Alice has N classmates. We will number them 0 through N-1, inclusive.
Each of the classmates brought Alice one container for the candy.
Each of the classmates also has a desired total weight of their candy.
You are given this information as two
Alice has promised to fill all containers with candy completely. However, she only has the time to make one type of candy, with constant density. This means that she might be unable to meet the exact desired weights of candy.
Alice now needs to choose the density of the candy she is going to make. In order to make everyone as happy as possible, Alice decided that she wants to minimize the sum of differences between desired and actual weights. In other words: For each classmate, we compute the positive difference between the desired and actual weight of candy they received. Then, we sum all those differences. Alice needs to choose the density of her candy so that this sum becomes as small as possible.
Compute and return the minimum sum of differences between desired and actual weights.
Definition
- Class:
- CandyMaking
- Method:
- findSuitableDensity
- Parameters:
- int[], int[]
- Returns:
- double
- Method signature:
- double findSuitableDensity(int[] containerVolume, int[] desiredWeight)
- (be sure your method is public)
Notes
- Your return value must have an absolute or a relative error at most 1e-9.
Constraints
- N will be between 1 and 50.
- containerVolume and desiredWeight will each contain exactly N elements.
- Each element of containerVolume and desiredWeight will between 1 and 1,000,000, inclusive.
Examples
{5}
{1000}
Returns: 0.0
There is one classmate. Her container has 5 liters and she expects 1000 grams of candy. Alice should choose the density of 200 grams per liter. The sum of differences between desired and actual weights is 0.
{10,10}
{1000,2000}
Returns: 1000.0
There are two classmates. They have a 10-liter container each. However, one of them wants 1000 grams of candy and the other wants 2000 grams. There is no way for Alice to satisfy both of them exactly. (Note that she must always fill all containers completely.) There are multiple optimal choices for the density. For these choices, the sum of differences between desired and actual weights is 1000.
{10,20,40}
{4000,2000,1000}
Returns: 5250.0
{1234,1541,3321,1234,123,123,3414,123,12,2442,1421,1223,3232,1123,2121}
{3213,1231,232143,44312,132132,142424,123123,41341,41244,21312,232131,2312,2322,11,2223}
Returns: 983673.2727272725
{30621,30620,2}
{1,1,1000000}
Returns: 999999.9999673415
{314287,380716,919002,841311,294055,538656,890236,805363,398590,3421,871057,808803,400283,104778,789697,808407,221863,533200,91123,867064,313610,629974,57552,269550,824107,484549,916095,773024,99570,129349,277225,998071,309961,612029,793014,273946,521941,98069,590925,788018,995393,545398,57750,912167,634354,189128,734266,41632,806483,130034}
{736837,567922,964157,449437,432969,954110,51709,39179,563055,352951,603507,285048,155934,269315,728966,587789,863487,340746,50015,334961,642106,730421,922085,792141,193270,668268,99777,544904,396315,105430,992218,448203,859026,674588,816921,982142,384387,842470,540390,920072,874838,757531,832808,449810,345777,443043,354823,565763,443455,264935}
Returns: 1.6638890146929704E7
{975777,688709,684170,536605,499250,14527,874751,303473,841814,61686,665564,62869,869557,615697,900934,64945,618549,731001,394471,804462,734593,982038,917863,182708,597439,630607,508718,957674,505368,290444,11555,158073,591411,392950,239662,16841,371449,933365,560760,713345,957649,939696,369769,400457,290788,610192,579816,434122,133593,843708}
{501933,896772,748198,705615,429759,673596,562702,111682,424872,277524,582048,343529,52366,75764,874372,926059,415513,386691,559521,195953,298226,60522,58464,388130,860737,287568,88296,327591,864877,918814,563106,132840,756062,731707,678966,780364,728958,906320,404107,545852,515186,562180,927817,189471,609829,506368,785306,474014,620157,293484}
Returns: 1.6082928085590072E7
{762014,738988,307993,544605,183282,558486,317836,171867,99597,560113,41561,992733,155222,980708,581225,672587,846390,293336,726691,152910,8533,424948,333872,614542,920602,656545,87415,262002,171629,622343,803233,859875,218232,868301,376278,939529,899296,462172,861373,7179,170384,641115,181246,870033,876334,315955,894403,243332,54562,207051}
{94307,736608,397410,701807,198991,560206,478269,442610,443523,56463,369398,963996,277226,726668,59508,116886,437610,390061,330528,88519,730987,838105,877281,69144,681366,942265,122208,250161,76051,820,979717,494905,784841,34739,814967,55448,521249,569566,932958,219256,20547,893020,213859,831358,953365,292117,381806,280789,273154,177906}
Returns: 1.3645560053450603E7
{829361,208844,33045,907212,479219,684432,130991,16925,110831,112441,728023,651496,893197,637870,104566,228242,571062,671192,16499,947973,14482,69919,437111,621865,857736,129642,558441,691941,905025,974433,898738,86434,398692,630829,452218,753736,325210,70390,32680,650238,184138,767587,888741,380588,617373,186205,420056,194747,358074,925196}
{339366,706019,476528,649371,304756,567056,744328,150391,351359,403653,183729,120239,129328,541226,305043,14122,97071,254822,344344,170705,386083,159842,946342,778636,254965,30469,861349,989762,795020,897400,973950,838171,404369,410722,28248,785409,201835,119660,897693,351833,976579,38013,909234,805838,206784,753663,968193,182021,836235,317527}
Returns: 1.6524631677973839E7
{255402,452435,550155,240535,765250,901531,166453,588006,852745,319868,511010,232162,389030,425246,347770,232819,97474,532199,198884,783360,63941,514498,831433,431282,971094,171285,541137,929008,397470,10441,120995,710627,291524,80773,138727,531379,850225,517170,567495,398791,226893,21687,258856,910983,498495,222525,177589,772444,539375,931051}
{938034,803817,656140,440175,862317,49440,669162,186735,272793,213778,35918,990399,533470,580009,940831,945605,583013,705738,812678,614252,770390,176095,319658,286810,761624,476368,752756,701368,701780,155269,626699,327341,418097,695269,981657,850593,993944,257944,723907,784062,299056,921927,18291,729961,938594,732890,812945,261069,70102,433208}
Returns: 1.904126941241528E7
{999761,999590,999335,999980,999855,999168,999634,999997,999605,999703,999993,999785,999395,999438,999517,999976,999666,999994,999197,999537,999009,999109,999337,999956,999977,999031,999962,999978,999049,999679,999135,999762,999265,999949,999537,999780,999690,999738,999767,999929,999732,999829,999738,999369,999157,999839,999985,999483,999336}
{170899,956718,527494,603178,930029,141412,621036,560418,111657,679591,822664,766458,811439,862943,761795,321947,523048,96051,827524,226924,233724,796747,239604,919766,920722,773712,87803,532544,522003,830442,475008,473427,324134,139968,899115,389110,845044,785275,396133,293138,966693,420418,859926,164687,528672,616126,777254,834516,602573}
Returns: 1.1567727238681482E7
{999350,999871,999508,999317,999393,999481,999985,999980,999574,999098,999020,999934,999261,999378,999764,999459,999469,999730,999938,999068,999374,999258,999573,999576,999953,999857,999269,999191,999669,999999,999859,999626,999547,999437,999726,999713,999370,999418,999783,999811,999802,999487,999557,999136}
{458778,500020,594146,423494,894219,954844,27371,129515,764054,585448,618850,911368,368611,945983,25326,817284,302937,146698,997816,302151,973088,331120,498151,68474,579106,13402,581988,647941,830276,922800,117271,686863,422065,89177,980903,88769,656463,624829,183165,289154,777350,434309,131712,948603}
Returns: 1.1943520663697615E7
{999416,999912,999069,999791,999457,999010,999949,999027,999726,999094,999646,999781,999800,999460,999687,999862,999558,999493,999904,999941,999656,999177,999386,999403,999663,999014,999772,999263,999331,999063,999782,999785,999682,999377,999569,999146,999031,999854,999869,999177,999879,999454,999505,999911,999460,999272,999581,999859,999198,999404}
{826061,980238,852920,761232,182562,693499,354543,708948,368389,416160,979848,747812,393694,715686,103148,320809,882903,984692,870147,769419,880790,512883,786420,280881,192707,642314,108072,862787,434183,236770,443654,164202,111754,647650,582327,217870,460851,185843,470690,727446,246698,61885,806192,402859,918105,18535,886985,72949,997925,725786}
Returns: 1.347703471886062E7
{999398,999216,999700,999432,999468,999670,999560,999199,999525,999198,999692,999389,999873,999071,999455,999967,999289,999905,999402,999623,999572,999965,999604,999789,999995,999202,999181,999960,999493,999529,999662,999464,999210,999665,999542,999990,999211,999579,999046,999610,999328}
{302199,549643,574285,883806,219554,774914,225386,879948,179676,317586,506028,888617,780750,631140,170360,503770,808671,58208,886201,59146,436344,658925,597524,528607,575681,329140,231028,606337,789345,585244,318911,817753,411905,684686,901917,379407,662728,22385,681975,136522,121567}
Returns: 9212946.280817159
{999044,999566,999188,999292,999787,999304,999878,999092,999726,999492,999640,999426,999198,999786,999011,999703,999578,999419,999718,999210,999371,999351,999010,999876,999800,999901,999094,999124,999353,999405,999107,999227,999351,999896,999216,999296,999865,999805,999806,999475,999528,999293,999668,999781,999083}
{921091,7340,943175,710089,850095,13174,236321,16310,801729,320976,630197,749319,641186,75618,691884,657189,102009,596373,225261,832760,231471,675473,518881,934119,369003,802685,712816,597594,849366,488194,434945,834682,651159,657223,509373,284335,524631,386741,978123,762592,742974,60788,192660,391414,397811}
Returns: 1.0646566153078096E7
{999969,999961,999186,999030,999403,999914,999240,999310,999115,999886,999239,999278,999800,999966,999040,999980,999946,999130,999042,999946,999162,999753,999765,999896,999375,999859,999234,999917,999625,999009,999448,999489,999129,999938,999608,999077,999255,999478,999329,999321,999034,999718}
{4,1,2,2,4,4,3,6,5,1,6,1,8,5,10,1,8,5,6,5,8,4,4,3,9,3,3,7,4,10,4,2,6,10,8,1,2,5,6,4,6,1}
Returns: 89.01253548368376
{999123,999454,999406,999745,999020,999893,999321,999094,999489,999479,999349,999594,999890,999139,999378,999341,999424,999786,999519,999238,999746,999171,999124,999685,999689,999095,999010,999067,999628,999948,999760,999007,999099,999949,999023,999713,999655,999128,999110,999074,999040,999741,999454,999362,999772,999021,999182,999616,999766,999391}
{1,4,7,7,5,6,9,2,6,4,6,8,3,9,5,4,2,2,9,9,6,8,5,6,7,1,2,6,2,2,6,9,6,10,10,10,9,4,1,1,6,9,6,3,7,3,4,6,5,7}
Returns: 108.99378204134301
{999112,999545,999668,999494,999800,999112,999431,999330,999387,999264,999729,999452,999458,999258,999107,999835,999773,999221,999780,999936,999867,999209,999261,999850,999156,999711,999357,999090,999377,999775,999308,999415,999017,999319,999939,999818,999213,999402,999609,999330,999884}
{5,3,2,8,10,2,6,9,2,1,7,9,1,3,2,7,8,5,7,7,4,9,7,2,9,10,6,5,7,8,2,4,5,6,10,2,5,10,9,1,8}
Returns: 102.97418339992616
{999416,999215,999201,999253,999423,999774,999406,999670,999506,999424,999956,999726,999185,999932,999939,999181,999509,999563,999994,999530,999133,999164,999530,999389,999530,999904,999425,999783,999035,999006,999946,999063,999609,999302,999587,999638,999011,999409,999700,999795,999409,999382,999957,999638,999092,999918,999152,999648,999691,999608}
{10,6,4,8,9,8,9,9,8,10,7,7,8,4,7,4,2,6,8,8,8,3,5,10,3,7,3,9,5,9,10,1,6,5,1,4,10,7,10,9,6,4,6,4,2,5,3,10,9,2}
Returns: 115.98554411819126
{999713,999848,999088,999269,999216,999096,999790,999494,999611,999337,999363,999909,999513,999060,999664,999890,999387,999472,999380,999331,999248,999862,999536,999683,999720,999141,999891,999103,999548,999805,999973,999522,999043,999415,999207,999465,999006,999987,999185,999414,999156,999815}
{5,4,2,4,2,10,4,1,4,8,9,8,5,3,8,8,4,6,1,3,6,8,1,5,2,7,10,5,1,7,9,6,3,7,10,10,2,3,10,9,3,4}
Returns: 104.99602806566799
{8,4,5,6,1,6,3,7,7,6,7,3,2,3,3,5,4,2,10,5,8,9,4,8,1,3,5,9,3,4,4,1,2,1,4,9,1,4,6,3,4,10,5,4,8}
{9,6,3,5,7,10,10,6,5,3,2,1,8,8,10,6,5,10,7,6,1,2,8,7,8,7,4,2,7,1,10,4,2,3,1,2,5,5,2,3,3,8,6,8,1}
Returns: 149.79999999999993
{5,10,3,2,2,7,5,5,10,2,10,3,6,2,10,8,9,8,4,5,4,1,2,10,6,2,10,10,9,8,9,8,4,10,8,3,2,2,5,8,2,3,6,4,1,9,10,6,2}
{8,9,7,10,10,8,1,7,9,9,2,10,1,6,2,9,9,10,3,7,7,8,1,2,2,6,3,9,1,10,3,2,1,7,4,6,7,5,8,8,1,9,5,5,8,4,2,6,8}
Returns: 187.39999999999995
{10,3,8,9,1,3,2,7,3,3,5,2,9,10,6,7,7,9,3,9,4,5,4,6,1,3,10,9,7,8,5,8,3,9,2,7,4,10,8,2,1,4,6}
{8,5,5,2,5,10,5,4,3,10,3,1,2,2,2,7,3,1,1,9,2,8,3,8,10,2,1,3,3,5,4,1,4,8,4,3,8,6,8,2,2,8,10}
Returns: 122.20000000000002
{9,7,8,4,7,10,9,5,5,2,4,10,7,7,7,10,3,6,10,2,2,3,2,1,5,6,5,10,1,2,4,2,1,2,8,5,5,8,10,8,3,6,9}
{4,8,6,9,9,8,5,2,2,8,6,2,5,9,2,4,3,8,2,8,9,4,7,9,8,10,5,4,1,6,7,8,1,9,3,10,1,1,9,3,7,5,2}
Returns: 155.0
{10,9,5,7,10,10,10,1,1,9,8,9,6,6,9,4,8,6,8,1,7,3,5,9,5,6,5,7,7,7,1,2,1,1,3,7,8,9,8,4,1,5,10,6,9,9,4}
{4,4,7,4,4,10,3,10,3,4,5,6,10,5,5,6,4,9,9,9,7,8,2,5,8,7,5,10,6,4,4,5,6,10,3,5,5,4,3,4,2,2,6,3,4,8,9}
Returns: 132.25
{8,10,3,1,1,10,3,7,1,5,2,6,5,1,9,6,4,3,9,7,5,5,4,2,3,1,7,9,3,8,5,5,8,7,3,8,2,2,6,9,8,5,5,3,1}
{999991,999998,999993,999995,1000000,999997,999993,999994,999999,1000000,999997,999993,999995,999999,999992,999999,999999,999991,999997,999997,999995,999992,999995,999992,999998,999994,999995,999993,999994,1000000,999994,999992,999997,999993,999993,999998,1000000,999997,999992,999996,999996,999996,999998,999991,999999}
Returns: 1.8285632857142862E7
{2,7,2,7,4,5,4,7,8,5,8,5,5,1,9,4,9,10,6,1,8,10,6,9,7,3,10,5,8,6,3,5,10,6,4,8,8,9,3,7,7,1,1,9,10,7,8,9,6}
{999992,999992,999992,999999,999995,999995,999995,999995,999998,999992,999995,999993,999998,999995,999999,999994,1000000,999996,999991,999997,999993,999992,999998,999991,1000000,999994,1000000,1000000,1000000,999997,999996,999997,999993,1000000,999993,999995,999992,999999,999998,999991,999996,999996,999992,1000000,999994,999991,999991,999991,999997}
Returns: 1.52499315E7
{3,8,7,6,5,3,3,1,9,6,3,4,6,8,10,1,9,2,6,6,7,3,2,2,1,4,9,3,4,2,6,4,10,6,2,10,8,7,9,6,1,9,5,3,6,7,3}
{999996,999999,999991,999995,999995,999991,999996,999993,999999,999994,999994,999994,999996,999998,1000000,999993,999997,999999,999996,999997,999993,1000000,999995,999999,999998,999997,999996,999994,1000000,999999,1000000,999997,1000000,999998,999998,999992,999996,999992,999993,999998,999993,999991,999992,999991,1000000,999997,999995}
Returns: 1.8285649428571425E7
{1,4,2,2,1,5,10,7,7,7,3,4,4,5,4,10,6,1,10,1,2,9,8,3,4,8,7,7,1,3,2,3,8,10,7,10,8,2,3,7,6,7,9,8,8,7}
{999993,999991,999999,999998,999999,999993,1000000,999993,999994,999996,999996,999992,999995,999992,999996,999998,999991,999994,999999,999996,999999,1000000,999991,999993,1000000,999996,999999,999991,999993,999995,999994,999999,999993,1000000,999991,999999,999998,999991,999993,999994,999999,999996,999997,999998,999996,999996}
Returns: 1.728560471428572E7
{3,8,2,6,4,4,1,2,10,2,6,3,4,7,9,8,4,8,8,10,7,9,5,10,7,10,5,9,7,7,7,10,6,3,8,4,3,4,10,9,9,10}
{999991,999992,999998,1000000,999998,999996,999999,999991,999998,999993,999991,999998,999992,999994,999993,1000000,999998,999994,999998,999999,999993,1000000,999993,999993,999994,999995,999999,999999,999992,999996,999995,999993,999994,999994,999997,999994,999993,999996,999994,999991,999994,999996}
Returns: 1.324993825E7
{978,140,820,414,400,435,872,245,984,708,882,49,264,740,614,718,454,72,833,906,653,213,1,682,643,513,770,315,117,23,786,57,471,838,877,817,560,114,232,922,787}
{584844,83720,490360,247572,239200,260130,521456,146510,588432,423384,527436,29302,157872,442520,367172,429364,271492,43056,498134,541788,390494,127374,598,407836,384514,306774,460460,188370,69966,13754,470028,34086,281658,501124,524446,488566,334880,68172,138736,551356,470626}
Returns: 0.0
{927,927,709,29,493,615,622,215,763,153,289,318,563,970,497,671,645,263,869,165,876,917,529,408,942,417,802,602,143,88,501,458,501,510,375,772,85,322,694,638,588,807,397,292,758,363,579}
{312399,312399,238933,9773,166141,207255,209614,72455,257131,51561,97393,107166,189731,326890,167489,226127,217365,88631,292853,55605,295212,309029,178273,137496,317454,140529,270274,202874,48191,29656,168837,154346,168837,171870,126375,260164,28645,108514,233878,215006,198156,271959,133789,98404,255446,122331,195123}
Returns: 0.0
{963,292,90,97,764,117,131,4,99,731,93,942,997,123,460,805,79,307,5,974,109,222,718,942,462,579,747,777,125,958,202,253,368,596,623,14,644,722,936,730,862,829,448}
{624024,189216,58320,62856,495072,75816,84888,2592,64152,473688,60264,610416,646056,79704,298080,521640,51192,198936,3240,631152,70632,143856,465264,610416,299376,375192,484056,503496,81000,620784,130896,163944,238464,386208,403704,9072,417312,467856,606528,473040,558576,537192,290304}
Returns: 0.0
{254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515,254515}
{18339,534711,847830,636800,848671,581087,368320,237866,58240,661623,238953,264485,159882,934036,225461,770344,981570,629257,650122,45862,322797,957806,67916,279509,335376,189717,89954,828970,337520,760597,785454,561882,738643,336578,220056,107866,112252,627442,157955,531487,751282,675577,772309,653278,33657}
Returns: 1.198073E7
{745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394,745394}
{945803,750102,157090,855744,262941,29519,865901,602084,55431,759463,584548,83266,305727,391140,664283,758272,534906,170380,142055,949379,641070,830947,609438,587951,14029,14254,858068,119658,558863,344626,903775,645656,825768,572020,108179,591136,769357,272825,266245,223140,190514,503943,915147,161036,717,202082,726457,48507}
Returns: 1.3169022E7
{764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302,764302}
{710693,658711,40762,144338,858403,257476,352949,452530,648,893608,817722,161267,964074,40296,985918,613275,436765,176232,245621,935021,557943,338574,587990,842352,168204,730046,6165,424808,880945,526046,682278,27418,954812,360915,125695,137099,584321,778498,360853,71936,306581,725583,397341,16574,311694,970656,338316}
Returns: 1.2761236E7
{1000000}
{1}
Returns: 0.0
{1000000}
{999999}
Returns: 0.0
{1}
{1000000}
Returns: 0.0
{1,1000000,999999}
{1000000,1,1}
Returns: 1000000.0
{245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953,245953}
{181721,527575,402666,646145,121120,269107,998434,425637,780954,649941,245623,503746,191595,498417,452206,901484,182649,503678,355788,213176,142953,500079,857430,505019,869471,993914,209042,264267}
Returns: 6078737.0
{839764,839764,839764,839764,839764,839764,839764,839764,839764,839764,839764,839764,839764,839764,839764,839764,839764,839764}
{347587,342781,834099,230706,658224,683941,551068,258249,226269,802392,263518,762318,264271,211947,820577,172277,620171,473012}
Returns: 3888197.0
{482997,482997,482997,482997,482997,482997,482997,482997,482997,482997,482997,482997,482997,482997,482997,482997,482997,482997,482997,482997}
{578326,374280,57017,561793,514422,669242,138584,387472,992302,358690,474443,129173,957829,64850,958519,229254,862079,903457,86528,418584}
Returns: 5227980.0
{812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323,812323}
{439948,876544,787376,298030,78400,457267,42417,439126,171392,96421,526954,53937,582258,259853,367518,7186,651578,90078,120404,636305,414846,426447,658192,475776,499043,998867,358743,112054,31821,466272,859310,505608,492131,322411,826714,539658,506759,498473,906272,934289,402081,324431,338758,576114}
Returns: 9065458.0
{864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401,864401}
{614352,423491,979909,108774,215811,911705,419610,639169,97251,806280,102392,577369,263288,32869,474436,890529,758852,371269,558562,547983,569933,83518,691128,178648,555993,504229,881322,65265,998763,658893,925854,293071,56650,321677,657721,803814,897722,145658,768800,170029,528384,597160,998647,43031,455329,873900}
Returns: 1.1713714E7
{31623,31624,2}
{1,1,1}
Returns: 0.9999683774467952
{30620,30621,2}
{1,1,1000000}
Returns: 999999.9999673415
{31599,31600,1}
{1,1,1000000}
Returns: 1000000.0
{1234, 1541, 3321, 1234, 123, 123, 3414, 123, 12, 2442, 1421, 1223, 3232, 1123, 2121 }
{3213, 1231, 232143, 44312, 132132, 142424, 123123, 41341, 41244, 21312, 232131, 2312, 2322, 11, 2223 }
Returns: 983673.2727272725
{699306, 459784, 845624, 517886, 440188, 603076, 813631, 997663, 698656, 779704, 167072, 275641, 5170, 151449, 187298, 605670, 189239, 978923, 44359, 727487, 371911, 696332, 256205, 435702, 595749, 811, 7297, 7395, 7983, 7091, 5, 9, 8, 2, 4, 7, 3, 6, 7, 5, 5, 3, 2, 9, 9, 9, 7, 8, 3, 1 }
{879765, 186522, 203015, 760200, 608571, 322726, 588669, 672175, 924087, 733771, 390179, 826237, 329992, 800371, 55306, 802527, 410624, 68938, 793084, 522102, 768766, 178, 951818, 532059, 777670, 964, 120, 994, 482, 111, 190, 612, 64, 13, 78, 6, 63, 68, 4, 19, 34, 49, 3, 7, 51, 66, 31, 7, 1, 95 }
Returns: 8746602.886743499
{10, 20, 40 }
{4000, 2000, 1000 }
Returns: 5250.0
{1, 1, 1, 1, 1, 1, 1 }
{1, 1, 1, 1000000, 1000000, 1000000, 1000000 }
Returns: 2999997.0
{100, 1 }
{1000, 20 }
Returns: 10.0
{1, 1, 1 }
{1, 3, 4 }
Returns: 3.0
{444338, 896105, 144046, 185516, 63994, 884136, 532704, 407792, 793380, 544563, 909016, 188628, 660401, 95477, 235642, 976827, 770798, 754268, 423609, 809511, 909808, 527983, 836949, 604389, 193114, 273997, 548013, 291862, 407567, 644368, 485660, 15535, 841990, 981701, 727487, 838703, 968981, 57587, 742910, 643595, 203074, 150600, 875785, 722416, 783010, 521453, 270677, 244602, 435842, 849066 }
{906963, 444938, 514152, 759746, 556244, 164911, 177878, 920512, 420822, 399809, 427673, 988133, 750991, 812302, 377763, 421581, 726753, 852185, 80416, 480476, 556203, 559839, 137091, 316760, 851590, 465709, 454034, 168449, 127752, 787652, 663290, 90797, 883136, 92985, 36064, 901073, 481697, 993449, 208835, 868555, 625003, 679190, 639835, 871436, 509279, 848943, 599670, 888562, 560730, 549171 }
Returns: 1.6865680965976167E7
{1000, 2000 }
{33, 47 }
Returns: 9.5
{1, 1, 1 }
{10, 100, 100 }
Returns: 90.0
{1000000 }
{1 }
Returns: 0.0
{100, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 }
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 }
Returns: 90.0
{30621, 30620, 2 }
{1, 1, 1000000 }
Returns: 999999.9999673415
{1, 1 }
{1000000, 1000000 }
Returns: 0.0
{132, 141, 569, 3532 }
{1, 128, 431, 563 }
Returns: 465.8669309173273
{1, 2, 100 }
{1, 1, 1000000 }
Returns: 29998.0
{30621, 30620, 2, 4545, 33, 434 }
{1, 1, 1000000, 3, 45, 4556 }
Returns: 1004603.8362834748
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10 }
{1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1 }
Returns: 999999.0
{30621, 30620, 2, 1 }
{1, 1, 1000000, 1000000 }
Returns: 1999999.999934683
{10, 20, 40, 30 }
{4000, 2000, 1000, 3342 }
Returns: 6342.0
{1, 1, 1 }
{1, 4, 4 }
Returns: 3.0
{1234, 1541, 3321, 1234, 123, 123, 3414, 123, 1245, 2442, 1421, 1223, 3232, 1123, 2121 }
{3213, 1551, 2323, 442, 1332, 142424, 123123, 41341, 41244, 25512, 235531, 2312, 2322, 11, 2223 }
Returns: 608442.8628005658