Statistics

Problem Statement for "GasStations"

Problem Statement

With today's high gas prices, drivers often go to great lengths to find the cheapest gas. In this problem, you are to write a method for a system that helps a person plan where to stop for gas on a long trip. You can assume that the person has already planned the route, and that it is fixed. With the route information, the system (which might be built into a car, for example) can retrieve price information about the gas at all of the gas stations along the way. With this information, your method must plan which gas stations to stop at, and how much gas to get at each station to minimize the cost of the trip.

More specifically, you will be given a int[] dist, a int[] prices, an int mpg, an int tankSize, and an int tripLength and are to return the lowest possible cost of the trip. Each element of dist, and the corresponding element of prices, represents the distance to the gas station from the start of the trip (in miles) and the price of the gas at that station (in thousandths of a dollar per gallon). mpg stands for miles per gallon, and represents the number of miles the car may travel on a single gallon of gas. Note that gallons need not be used in whole amounts. tankSize represents the maximum number of gallons that the tank of gas may hold. The trip starts at mile 0 and ends at mile tripLength, and you start the trip with a full tank of gas. You may purchase any quantity of gas (including fractional amounts of gallons) at any gas station.

Definition

Class:
GasStations
Method:
tripCost
Parameters:
int[], int[], int, int, int
Returns:
double
Method signature:
double tripCost(int[] dist, int[] price, int mpg, int tankSize, int tripLength)
(be sure your method is public)

Notes

  • Your solution need not be exactly correct to be evaluated as correct. As long as the relative error between your result and the true result is less than 1e-9, your result will be evaluated as correct.

Constraints

  • distances and prices will contain the same number of elements.
  • distances and prices will contain between 1 and 50 elements, inclusive.
  • mpg will be between 1 and 1000, inclusive.
  • tankSize will be between 1 and 1000, inclusive.
  • tripLength will be between 2 and 10,000, inclusive.
  • Each element of distances will be between 1 and tripLength-1, inclusive.
  • Each element of prices will be between 50 and 20,000, inclusive.
  • The trip will be possible.

Examples

  1. {100,100}

    {1000,1500}

    20

    10

    300

    Returns: 5000.0

    The 10 gallon tank allows the car to go 200 miles on a full tank. So, in order to get from the station at 100 miles to the end of the trip at 300 miles, the tank has to be filled up at one of the gas stations after 100 miles. Clearly, we should fill it up at the cheaper one, and since we have gone 100 miles so far, we need to buy 5 gallons of gas, for 5,000 thousandths of a dollar.

  2. {300,450,525}

    {1659,1529,1439}

    20

    20

    600

    Returns: 15277.5

  3. {300,450,525}

    {1659,1439,1529}

    20

    20

    600

    Returns: 14940.0

  4. {300,125,450,525}

    {1659,1729,1439,1529}

    20

    20

    600

    Returns: 14940.0

  5. {200}

    {1000}

    20

    20

    400

    Returns: 0.0

  6. {5217,3999,6536,3131,6007,3710,4257,4937,4053,4849,6138,7364}

    {11488,8144,19069,14724,16286,1533,10936,2287,7062,8109,7688,14123}

    219

    21

    9016

    Returns: 33353.14611872147

  7. {848,1281,1484,1005,1405,792,731,3468,138,60,3173,193,1445,1537,593,2897,1289,3542,3351,3887,192,1028,3486,3852,1602}

    {631,3516,7849,18046,2932,11702,13118,13269,5262,8389,11095,1320,12756,2481,14055,4617,7075,10010,14204,3935,3218,9098,16899,6350,3786}

    524

    3

    4184

    Returns: 13265.65458015267

  8. {3576,5226,982,6921,1232,3764,751,7194,5130,6835,6318,3320,5239,6873,2065,7017,6818,2172}

    {9719,8252,6668,12841,18446,14775,15271,18265,10229,3869,11499,13381,1227,5861,12823,17444,7651,15216}

    491

    5

    7253

    Returns: 54878.160896130335

  9. {3158,3309,1424,5151,7258}

    {10213,9892,6729,16617,17847}

    10

    485

    7750

    Returns: 2418268.8

  10. {7315,900,4260,5299,2761,733,5362,4309,1836,7794,2184,8513,8038,118,2528,1984,4467,8282,4344,461,4514,7651,479,4998,5329,6359,6407}

    {10704,14697,2360,1130,9479,17075,14671,12676,13247,4408,14181,13049,11608,11655,574,18703,7268,5780,16662,12174,3005,17639,7743,17814,10727,13114,13583}

    14

    122

    8817

    Returns: 1958585.285714286

  11. {8157,1249,2737,4512,8390,1030,8386,5193,7719,1603,3312,7804,2964,5816,7198,843,2250,5711}

    {4293,19531,12749,4338,14754,13200,14332,4382,15557,8438,15445,5334,4686,3005,10113,14268,6914,8119}

    2

    710

    8490

    Returns: 2.02115845E7

  12. {3939,5864,7376,6255,5520,2368,4831,6270,1196,4814,3630,3102,4939,2784,4079,1303,8301,7646,7216,6930,5141,8096,4398,2800,8694,6807,5825,6763,820,5253,4758,2665,8315,7931,8765,7071,4526,6201}

    {1129,10351,5626,3588,16776,7247,15055,691,18487,3319,10510,6569,15571,15637,12904,8600,5728,11526,13119,5185,3184,10560,18066,19362,18632,19718,5711,6958,7644,5179,15282,11162,14681,16937,12220,12853,9482,5657}

    216

    17

    9372

    Returns: 30227.333333333358

  13. {1469,238,1252,3232,29,3648,1510,1508,652,2927,2292,972,3309,935,1821,1598,1861,1410,920}

    {3475,17776,9448,3725,11317,16790,10711,8939,15915,14265,15232,9137,11968,15568,10802,7616,13740,15816,17965}

    5

    515

    3789

    Returns: 843730.0000000002

  14. {2674,3011,1847,4363,5097,5617,4565,4591,3846,4688}

    {6664,7374,17611,9518,19564,4695,1880,13282,17822,11695}

    340

    13

    5694

    Returns: 9084.70588235295

  15. {1553,915,259,6348,8779,3975,7433,122,2630,4753,154,7522,7758,5607,4469,2651,6603,8575,8353,8124,5425,7367,7339,4322,6105,8292,5910,1834,8224,7637}

    {12893,19059,3075,17135,18156,19708,19212,9170,18168,17748,17242,10872,15487,1119,11160,3377,13882,14905,10803,12856,7031,9195,8913,17810,19320,12207,11089,19209,4314,7908}

    396

    21

    8948

    Returns: 1785.878787878788

  16. {2241,7122,5932,5632,1903,1789,6053,8144,6212,2559,4261,209,4447,7623,3711,2527,6060,247,1471,4662,4868,402,8086,7248,535,78,4304,6268,3063,7814,6926,290}

    {8216,12315,5958,12933,17602,14388,12426,17336,19728,6524,8374,1322,10736,6642,12379,16176,2734,19233,8708,2334,12885,6951,17216,19726,16125,143,16650,1750,4768,13255,2715,15692}

    166

    48

    8474

    Returns: 4241.481927710848

  17. {2385,6179,1122,1869,1591,1802,118,4256,5023,4946,557,5604}

    {1853,3936,12616,4790,19773,17204,8055,10909,13177,5685,11255,18573}

    152

    27

    7803

    Returns: 63100.71710526316

  18. {7356,4236,2771,3151,5527,7959,8312,203,1509,2337,677,7211,443,2557,8169}

    {13112,4151,19235,11843,19975,9957,12515,2699,16133,15610,1944,12965,18318,15729,6360}

    278

    12

    8360

    Returns: 93985.60431654674

  19. {6506,4343,1844,8864,1743,2626,7978,3314,380,8177,5932,1636,2993,3315,5523,6663,5576,4087,2876,9709,8034,832,2909,733,3647,6570,1199,2119,3032,119,2814,7149,1577,5251,5227,8717,6105,7661,5967}

    {18052,238,2379,11089,1146,17778,4225,17356,12233,17042,8824,18203,168,6284,13272,9276,16090,741,9702,4225,6175,15013,3074,7862,7369,10973,17280,7666,15677,12607,230,2819,9419,16805,3802,2488,2780,19393,11320}

    19

    319

    9972

    Returns: 37963.578947368485

  20. {110,1932,1360,1237,3414,2560,940,1371,1581,3060,3407,716,3100,651,1530,1645,44,665,1074,658,2700,3142,2716,1476,776}

    {721,10741,9168,12427,2931,15320,8212,17751,8814,18700,10459,9222,18337,18022,5759,9454,18481,10793,8089,10137,7387,4392,15451,4800,1413}

    95

    7

    3489

    Returns: 160094.5052631579

  21. {660,1244,1605,419,476,505,1642,595,120,327,1312,202,379,1509,1133,687,451,448,1235,858,737,1226,680,1353,663,1312,638,1342,986,884,123,937,467,524,104,1258,467,72,864,1389,512,216,1568,103,134,1372,1013,328,862,1554}

    {18146,6470,14642,9565,1465,9885,12664,17128,2302,7070,10480,12102,7542,14312,11413,3422,14794,11198,2010,14704,116,16462,10804,1349,17033,9743,13518,988,11730,4172,17628,15611,9285,10104,5214,9879,16375,18169,19687,454,8482,9662,14194,6652,13723,18498,13996,7998,5853,4527}

    586

    1

    1678

    Returns: 861.8139931740618

  22. {1178,138,722,2789,589,690,2655,3627,3105,3270,3339,3258,2775,2609,3209,3351,1401,3113,2210}

    {14660,1351,4467,16430,17135,10903,6562,7799,4592,14930,18997,9486,7185,747,1324,8069,11529,19972,6279}

    32

    105

    3675

    Returns: 7353.28125

  23. {1992,3317,5398,3771,3073,1724,3614,3736,6057,760,3469,4042,3178,2049,4588,1581,3693,2746,5032,4265,3086,5332,2135,745,1573,4083}

    {2908,4801,18158,18574,5509,4691,15834,9689,3773,12812,12533,14736,17758,2941,15821,11538,4575,236,5775,5107,14807,1641,10888,19827,13661,7431}

    8

    532

    6518

    Returns: 66729.0

  24. {4324,6198,5978,4816,4592,402,2452,7282,7341,7445,3823,3507,1747,7753,5445,5188,720,7695,1761,6196,2138,5157,3820,3081,3689,4389,2721,4835,379,4488,7591,1540,4709,6840,7713}

    {10535,16801,17849,2626,2744,12290,16733,13625,12168,9968,10324,9795,3728,18240,18916,1271,13878,10468,9572,3492,9661,13082,19971,5513,17979,9671,6999,3302,1116,10504,5619,7178,19022,7518,15886}

    290

    15

    7754

    Returns: 16896.37931034484

  25. {170,75,1226,1026,692,763,1394,2955,1352,778,235,1041,2555,1128,2339,1784,2693,2823,1359,1363,996,1617,10,2075,2531,1203,2569,1949,769,1678,2064,2588}

    {278,9246,5963,14591,9170,13355,5041,6952,12422,18254,19027,18867,18072,19189,10868,641,6364,4835,16887,7310,14272,2577,11968,11181,8399,11387,5587,15766,6175,4189,10848,9038}

    249

    11

    2992

    Returns: 403.4658634538199

  26. {4698,5174,3833,415,4700,2327}

    {8748,12862,7798,4120,10348,14850}

    38

    76

    5658

    Returns: 626622.3684210527

  27. {2292,6489,4518,2389,3255,2555,9942,9434,6034,9614,6612,1898,2002,9200,9595,5427,136,4623,1492,9637,5190,610,9793,1267,9475,4211,7385,2874,2364,6956,5386,2246,9260,5284,7417,8730,7374,8566,8050,4351,8648,7279,7303,7449,9304}

    {7052,1529,16535,9530,17054,1049,11734,13894,3554,16896,15608,12781,15163,6589,652,17772,2150,14165,8758,4946,16009,5432,6812,18345,4341,12432,5474,1336,14888,13754,5938,2568,11812,11800,557,1779,18436,7599,12194,3997,6612,11882,13568,9570,9538}

    22

    254

    9959

    Returns: 151568.86363636365

  28. {494,6527,6582,5601,2192,6144,5710,1595,8576,7758,7395,2022,607,876,3632,1068,2525,6003,4970,2365,2469,4939,5908,302,3329,7557,5436,1786,8284,7504,6753,150,8268,7074,5164,8202,6578,8072,4855,4259,259,2428,2100,4060,7628}

    {13900,19914,15132,13281,15971,447,9366,3384,14859,11230,6669,6171,7119,18594,10298,8117,14199,8645,11603,7089,10127,7595,1322,758,6410,5878,15189,8160,12469,18950,18935,12292,7972,4624,8225,9335,14833,2953,11012,1683,6039,18845,12489,16359,14253}

    28

    150

    8710

    Returns: 144793.14285714293

  29. {478,488,108,481,1122,1308,377,3069,2844,2862,3219,1202,3259,1525,353,1965,412,872,1727,187,2501,2930,3074,2321,1701,352,832,484,1207,730,2492,217,3074,2223,2200,391,2734,65,617,2156,1098,3046}

    {17005,15624,266,5421,6169,7509,13902,6735,11406,8552,10865,13973,1770,4023,16313,3105,4387,9146,2355,18671,14410,17023,18816,16973,16819,18821,11684,6830,18926,1821,9375,5839,3310,6180,18959,6454,16068,2006,4471,4250,4699,1211}

    103

    6

    3271

    Returns: 80379.91262135921

  30. {372,830,2188,100,1518,2257,2058,1922,1665,898,1186,1235,2049,410,549,1618,2002,136,2328,943,73,501,843,605,1806,246,444,235,1428,2067,1542,102,21,143,1089,2081,1393,831,1158,628,9,973,942,849}

    {10470,13282,4730,1922,15332,12767,16641,6489,16759,14220,4462,8118,5048,4044,14875,15875,3439,3732,454,17020,1325,16191,11148,10586,16849,687,6349,12584,5105,9828,15623,3717,6037,7668,3495,2823,15038,19455,15041,2772,3653,10537,4756,14764}

    6

    320

    2387

    Returns: 107475.33333333323

  31. {4817,5452,2971,1382,5278,253,5238,7140,4811,3971,3604,4835,4654,7065,283,982,3682,2422,5295,2489,2070,3390,3984,5398,3265,4523,6197,975,1140,5658,3660,2395,3992}

    {3151,3061,12804,17401,9737,12131,13684,9778,15365,15520,1462,2760,4487,7621,54,5133,13839,19323,527,17845,8618,19157,6067,16337,9992,9668,17065,12971,3835,14262,10186,8134,16704}

    893

    5

    7198

    Returns: 2035.69652855543

  32. {2656,5429,5066,5083,3051,4559,3745,1288,2679,2730,730,2687,2187,554,4939,1085,2281,147,3732}

    {3371,13381,17170,15099,3502,19679,11354,18781,3723,19767,7343,1077,3999,147,9766,515,17887,16786,17543}

    552

    8

    5588

    Returns: 812.684782608698

  33. {3765,4561,1862,3970,1551,314,500,4253,2756,136,1685,438,2272,5153,1590,3130,5043,1378,1822,3643,766,1719,1157,2489,1335,870,3048,4099,4169}

    {8595,15769,19486,8214,15157,10351,19749,16447,1243,13827,7223,1605,2476,15703,18112,2476,8314,16704,5602,15298,12563,8493,1532,10702,17823,8652,13606,10912,16393}

    6

    598

    5279

    Returns: 350318.8333333332

  34. {1234,4467,6535,3997,5094,3802,454,974,1589,5818,6702,2587,1153,1825,2695,2001,1529,3403,3868,2472,622,4548,4947,2391,6824,5461,3513,2363,4229,3194,7110,7079,1194,461,294,3325,6802,3312,3464,3504}

    {18353,16873,13207,19814,5722,17748,19474,17526,7575,10132,8785,10964,7643,1255,15579,4832,4542,15834,16442,16661,8547,4163,3285,11055,4151,11172,5876,2674,11351,3677,17873,1292,6112,10998,11060,3118,11223,10812,10816,17549}

    174

    16

    7151

    Returns: 57517.1091954023

  35. {1940,414,1219,2300,754,3641,3548,2098,2373,3465,2383,1970,509,2602,1575,2223,2232,3504,823,3377,1753,946,2808,3852,1817,3685,880,2137,1984,2906}

    {5636,11303,7368,18026,363,2498,7960,6052,1065,1992,1673,2346,12953,12988,18444,9696,1586,4944,9641,7286,1557,18691,13542,16248,14945,11848,307,18565,8691,19264}

    4

    415

    4021

    Returns: 461856.25

  36. {8575,2878,88,1927,3162,8638,6976,6978,3289,2037,829,5890,1320,6420,1714,962,2777,4167,2242,7627,3092,3355,1971,3838,4636,6305,3072,7038,6956,5053,3604,4566}

    {18927,12563,12440,19465,17348,17175,10358,2021,9017,12243,17724,6536,5331,15063,11145,12916,3896,3772,18323,16475,15950,9750,3394,19984,6400,19181,15624,17392,12449,1307,17039,107}

    8

    645

    8879

    Returns: 49741.625

  37. {3774,3908,4142,1560,610}

    {5808,19486,3524,4133,1931}

    9

    247

    5480

    Returns: 1322716.0

  38. {1693,1015,963,2600,1137,780,1948,217,1987,1727,530,966,2625,2417,1225,14,1734,319,2631,594,1634,2636,1221,2517,1736,77,1822,333,843,599,2463,1295,2047,2611,3045,1398,2046,1146,1377}

    {1293,13764,6284,7764,7026,1476,13121,2461,13082,18193,2369,3530,9608,833,9974,19690,17883,7499,9713,6995,197,6541,174,14250,2680,4773,12556,11648,7699,15280,7423,6873,15495,10164,8702,16571,13031,8254,2024}

    3

    805

    3345

    Returns: 53939.999999999985

  39. {5621,7842,178,7586,4705,7076,6483,6231,4355,492,491,1102,498,6839,7629,7051,3993,3273,7580,5509,3676,4317,5919,2879,4896}

    {4934,15145,13578,3995,4967,9790,1946,8932,5579,18675,19893,2585,4197,4304,4089,16781,106,13161,10073,12613,17223,9971,17770,19346,4723}

    713

    3

    7940

    Returns: 24773.479663394115

  40. {781,3956,1155,3332,1339,3111,2440,2793,268,1826,1889,2841,3881,3245,2012,3976,2642,3642,3735,2792,1907,478,2725,1074,4372,348,522,480,1994,2946,3981,3954,1597,3099,3230,2980,2079,3285,4505,906}

    {10198,19913,18140,5828,14382,17533,4704,4022,8806,10763,11985,8777,7266,16206,19816,16876,3924,15759,364,7569,3260,19892,17049,3742,15585,17702,6485,15071,6724,7284,7122,2102,14528,14886,19021,17000,13245,17106,10476,4530}

    123

    6

    4559

    Returns: 107487.19512195121

  41. {3703,2039,2697,1186,2948,1736,1620,2420,1790,2784,1205,3365,890,2886,125,2780,60,2677,116,26,3392,2568,2406,2164,2026,2345,969,3163,3021}

    {17340,14316,10485,16636,9444,14211,10381,15230,17148,16727,8389,19352,1550,18875,6009,3299,15096,4923,19725,12135,3524,3282,2194,4044,3063,8127,10746,18675,15047}

    8

    380

    3920

    Returns: 170500.0

  42. {2632,1665,470,5320,105,5161,3961,1937,229,1853,5023,5424,3908,592,4153,1738,3634,2134,828,3877,986,1126,253,3401,3643,5403,3842,2960,391,190,3335,2949,5038,1421,438,1497,1255,1399,1213,1433,4488,2301,5292}

    {12011,12249,2045,17975,10434,13517,17914,7186,14215,3521,4630,1453,14885,9801,11248,1126,10029,10343,17785,13666,1769,8206,12221,10191,1259,8340,10907,7615,4019,18293,17141,18729,3033,4494,18702,19778,10362,17866,3376,9677,17719,2453,19484}

    952

    5

    5489

    Returns: 862.2415966386573

  43. {1358,3952,6644,2687,9031,3554,856,1086,7562,7930,2937,5095,6037,6887,2141,7319,6712,6350,1454,3232,3822,6044,2433,5256,3155,3935,4298}

    {1886,1703,14226,3321,14339,18251,2852,6867,3594,1497,18418,8401,14605,9271,9071,15540,3267,11285,1027,3516,9817,8927,10048,10319,13313,11333,16812}

    200

    28

    9065

    Returns: 23420.905

  44. {370,7172,5593,6886,3221,5491,114,6935,1072,5494,3163,8085,2008,6136}

    {6100,10389,7307,10048,9674,19550,15607,15635,12158,14219,15436,14617,12209,5443}

    93

    87

    8353

    Returns: 15334.043010752663

  45. {591,950,568,1780,1718,895,635,552,1570,756,2340,2003,2116,2087,1500,1804,279,1076,1037,2133,424,2120,2206,1230,331,672,1183,414,1534,1056,1922,680}

    {19560,19508,16890,9931,14800,3169,5085,9572,16430,5761,6132,3399,2893,11800,2470,7424,16065,6284,15977,4610,12726,17191,8056,12423,16533,4458,2737,14610,6895,13223,564,5653}

    154

    15

    2368

    Returns: 212.4155844155862

  46. {448,401,2191,516,2062,2693,416,2362,903,2751,1309,2652,696,2960,848,12,2469,1479}

    {3195,7534,19729,6166,3577,9024,9130,19486,1756,4864,1672,12158,15415,10289,1188,4919,9908,3023}

    438

    4

    3106

    Returns: 4370.43607305936

  47. {6581,3757,8867,6104,1460,7714,128,5653,7727,1725,7300,5617,7022,6721,3069,3793,6581,1918,83,5978,759,8114,4080,4162,3121,1498,8390}

    {15030,16800,1386,13722,9757,14087,8573,19724,12686,15906,12033,16735,16436,7480,16300,10728,19848,15099,17575,16208,18317,11195,663,12339,9773,4756,7490}

    7

    927

    9974

    Returns: 330079.2857142858

  48. {1087,4169,2734,1334,17,2313,1170,4321,5951,701,2248,510,1188,3571,4648,1040,6320,4067,1923,2927}

    {2044,67,10407,12028,10501,1001,14521,2437,14679,3505,2646,5118,11690,15967,14377,1856,12944,19600,11721,8543}

    46

    151

    7364

    Returns: 608.8260869565223

  49. {12,3415,721,274,570,3759,1257,1124,2435,2165,1371,72,1465,3813,2409,3069,382,900,3412,990}

    {523,4705,2396,6777,6299,405,7292,18160,13051,4483,235,3606,17506,5713,1667,12953,1465,9407,3491,17959}

    6

    738

    4442

    Returns: 548.3333333333641

  50. {4069,802,1415,277,4038,1883,1362,948,1733,809,4046,758,645,1980,3134,2220,2935,3222,3255,2717,3653,4022,2745,1240,3396,2979,2378,2167}

    {2134,16001,10811,11536,18338,13467,7545,11935,16226,19673,6982,6506,1382,4323,15644,5203,12462,14052,3818,15248,14278,12549,16296,4568,17148,14092,11335,12120}

    13

    294

    4195

    Returns: 39652.76923076928

  51. {2908,1833}

    {303,2153}

    337

    7

    4941

    Returns: 5335.299703264094

  52. {6118,7015,6095,2944,3306,1621,2298,7655,6966,722,1648,525,1677,5029,2409,7468,2255,6452,4722,4389,5608,859,3280,6232,149,5689,5865,5834,6592,4731,5896,1531,1147,6267,6301,5394,5106,829,2266,4940,1071,7124,7414,3264,7442,1086,1780,5427,6977,3212}

    {9922,1635,18136,8592,12560,18546,19069,11236,18902,13100,5159,15745,19294,3651,6388,6483,6160,18129,10813,7846,2086,6155,7089,16615,13357,14856,3990,15642,16355,9518,8128,14839,19706,1221,5909,15586,19466,9268,1177,939,17298,900,14957,12174,18522,8897,14319,4788,19153,16031}

    43

    135

    7987

    Returns: 46866.06976744188

  53. {2137,323,551,4876,4078,5591,3255,1756,1532}

    {13591,14576,10602,3396,19569,19747,12983,17949,13713}

    5

    233

    6107

    Returns: 1.12235828E7

  54. {1401,73,5648,2901,5917,4908,6408,7132,2136,3686,5857,4467,3961,352,7130,6971,6857,4654,3248,6794,5321,6441,1672,2242,343,7474,3129,2841,3538,6633,5514,6301,975,2955,7204,2170,5443,5587,4659,2617,1028,5391,4380,2556,614,6340,3283,3785,3930}

    {4409,12391,10660,6081,4857,15072,8771,14153,5570,17200,10528,3107,7915,18798,7745,18623,4436,16941,8586,2367,6080,11572,2755,14099,18696,6923,983,18624,13355,11516,17899,17222,1359,9225,4488,69,17030,9334,16733,14380,18199,18927,19708,10425,16362,7361,6279,9820,17304}

    30

    189

    7671

    Returns: 4602.300000000032

  55. {5515,4236,3506,6711,5116,5812,1048}

    {4850,16031,12921,8316,15381,9670,11497}

    178

    30

    7046

    Returns: 53018.67977528089

  56. {1676,1435,1048,44,211,1017,1384,1377,1535,1394,1355,340,1216,376,1244,1513,1285,1000,1595,1520,50,418,831,1243,1223,723,1392,960,851,440,250,1389,1133,198,1265,37,1559,187,1505,954,159,1603,1449,568,174}

    {7922,7535,12774,15437,5514,12640,4168,15898,2287,10166,7137,19658,4374,19187,10097,18791,7149,16282,7156,15959,19492,18492,11722,12633,5612,928,2065,15634,16070,3875,9578,6613,9639,4345,19301,8026,12316,12857,5585,8718,11018,10220,15049,14684,7798}

    5

    200

    1716

    Returns: 132889.6

  57. {4831,4109,2590,1269,4886,2629,2840,790,2300,4996,4122,3920,945,2940,3042,1844,745,2018,1632,157,2705}

    {278,16397,10231,6566,3019,10948,7403,2619,2529,15387,16784,1459,10049,10084,14761,18589,5849,8044,16342,17870,12759}

    14

    185

    5518

    Returns: 348836.0714285715

  58. {3694,867,882,2572,1104,1687,1469,805,3092,4205,782,1260,2040,4426,4872}

    {11005,9826,14774,10000,13291,11607,11100,7622,18268,5144,16361,13154,5617,11904,6860}

    43

    33

    4938

    Returns: 561614.1162790698

  59. {1354,928,3908,2061,2757,2526,1447,2217,3477,3200,238,3587,370,4022,2345,2541,3555,1091,1338,2122,1395,445,1492,1410,2575,2875,573,2827,1750,1669,460,2416,1303,1208,971}

    {11980,19244,12766,4377,18173,19499,5827,6843,19046,2363,11301,3047,15912,12155,9939,12667,12612,11218,12662,13000,15873,10160,18324,19518,4235,6776,8059,10390,4167,11013,7477,7423,14368,12868,1845}

    18

    78

    4305

    Returns: 435750.72222222225

  60. {4693,3974,1126,5163,2217,566,664,28,6084,3936,3273,1621,4452,2688,3995,5275,3866,6582,3358,2553,138,3204,1815,375,681,3725,4156,995,765,1751,6389}

    {12278,3943,13183,9509,11244,15357,1408,18223,19871,15120,8916,11546,11797,3299,3481,14408,17985,8804,13923,2159,6334,16704,5542,11217,6355,10321,15880,9266,10448,6650,4861}

    8

    765

    7297

    Returns: 255309.875

  61. {1726,2411,749,3111,3239,961,3765,409,120,927,1839,734,1818,468,1529,1135,3067,2706,3012,2322,1001,3178,1245,338,93,1104,1999}

    {19045,7385,19385,2809,10889,19722,19257,6419,12505,13789,18182,7244,13578,13898,5431,15945,18938,8657,13505,5702,8409,3121,6096,18617,18870,15919,12670}

    62

    49

    4264

    Returns: 58632.903225806534

  62. {4288,4080,3969,2591,3923,4239,2109,2380}

    {10551,12369,10024,3241,15230,19390,3043,13452}

    581

    5

    5052

    Returns: 11257.908777969024

  63. {1778,3036,5540,4629,3968,1053,1731,4203,5671,1174,4726,451,222,95,3960,3851,2163,3236,854,4212,96,528,5693,5331}

    {1189,5230,14214,19314,10453,18578,7795,17357,3452,9510,435,10288,11546,17797,14884,5293,18964,18216,2994,12783,4266,2466,4178,13242}

    98

    12

    5735

    Returns: 140682.78571428574

  64. {2006,5882,871,3618,458,3210,5588,5277,5528,5621,4972,1768,7300,7788,5408,5668,6625,7555,3673,2940,644,6099,3972,1986,4157,2712,1502,2677,2428,5532,3624,6921,2185,3130,4012,620,4636,1252,210,816,1593,4812,1071,3133,7088,3122,2409}

    {6440,7364,492,2949,7080,400,4602,17756,14699,5662,4838,17156,2469,1250,16423,2546,13256,16075,6699,2227,2222,11421,14307,12605,7249,13798,5695,18373,17119,2004,14989,13049,7239,6458,4453,6861,8539,5528,15397,13672,4914,6263,17191,7834,8890,18212,18971}

    8

    492

    7821

    Returns: 326477.25

  65. {7804,1620,7750,952,2708,6836,7013,8387,2862,5797,4960,2931,5285,5676,6601,2030,8053,2401,2294,909,4860,3435,1279,4473,124,1671,3837,8399,4407,3298,5325,7644,2930,2041,907,4866}

    {12553,15759,9666,3545,2930,13545,14841,14539,532,10092,5942,6139,19748,13476,18814,1043,13575,4624,10129,15840,16485,17841,583,5053,16585,8781,14421,4345,6587,12093,9573,10051,17106,11591,8334,4350}

    216

    7

    8609

    Returns: 150060.67592592596

  66. {2313,1419,4519,2968,7106,1742,5849,6126,1152,8297,4893,3325,5189,3022,6658,6252,7065,769,8010,803,1618,2877,4180,7868,5284,1496,4371,4941,465,4051,5135,366,103,7915,4989,7231,3071,5662,3330,3121,4978}

    {1621,7888,4986,16861,17146,5845,11691,18939,13587,19571,10851,1917,5900,17354,3436,13337,14612,16044,8571,10921,4747,10284,16537,13338,11798,19208,5410,165,11239,6295,14882,15691,8756,18530,18392,18439,18848,11412,15623,7677,19247}

    4

    374

    8487

    Returns: 4692495.0

  67. {1303,6218,4161,6440,6152,2604,1316,2421,4254,988,6008,4960,308,349,5276,218,1617,1541,6017,4298,419,3593,5993,902,1432,3579,3197,4511,5209,5673,3183,2189,4905,4076,316,4023}

    {19163,3457,10381,11448,19692,8375,2657,19029,1092,19767,13865,12490,13920,5134,1180,2195,18675,7339,12535,16816,4126,11734,10395,7969,7314,15451,19509,6763,6524,3936,8293,11454,2865,10172,16720,15359}

    12

    78

    6445

    Returns: 1991903.0833333333

  68. {1379,6641,3136,5420,3115,5723,7777,2430,3799,2072,622,5227,5044,7383,4,3744,361,4094,1408,4776,3428,4036,6871,2174,5273,2845,768,4922,7025,5616,7331,953,6593,615,6999,23,4652,2305,71,6738,380,4297,311,1275}

    {5506,15947,16698,8177,12552,15236,15911,11343,1579,13115,18619,11588,2435,9308,4148,19262,12209,113,7683,4287,19172,1975,11273,13780,6388,8856,14559,13022,13262,1970,14112,6234,9159,9828,9601,12450,19420,18773,5762,8538,14286,9250,441,4669}

    291

    26

    7920

    Returns: 137.46391752578288

  69. {74,7356,4773,1786,318,3623,1915,2517,2101,6623,5855,7482,7283,5512,495,3138,7155,4473,5735,3938,2471,2593,1737,5529,5715,6891,4542,5001,3907,6665,5735,4549,1205,5514,3720,1125,5151,3404,2443,1672,693}

    {14927,12982,19162,4545,5418,4510,8516,16821,17440,6101,3191,6466,16013,10044,10029,3331,11191,7613,14112,9458,19757,1694,1639,4905,18106,9894,5447,10621,15960,13935,14081,12976,8498,15397,17751,5560,14032,11836,719,19890,899}

    533

    6

    7832

    Returns: 16008.270168855535

  70. {99,7042,6115,4457,1811,2732,7573,5555,4712,5579,3114,7052,6187,5203,8229,3742,3487,3533,9607,4481,2961,5616,8807,3127,7992,5917}

    {6448,9265,2764,14791,5443,14247,12223,293,12003,14203,18736,10578,769,18349,5034,3771,13070,228,16871,16185,16681,8388,11067,2001,7404,17370}

    6

    484

    9730

    Returns: 1163914.5000000002

  71. {980,4,1885,2659,1414,1855,2643,2988,2307,1284,1970,3483,2427,486,2549,3113,383,1999,2582,1437,3434,1596,529,2800,2587,1345,1977,242,2001,425,2586,610,805,436,646,1118,643,2771,600,3256,504,1679,16,2957}

    {4235,8186,10124,6225,17863,6768,3680,18910,7811,14403,2077,3854,16902,8052,6844,11864,9075,16513,5472,17628,15073,17854,9241,18898,4513,1389,19877,7542,8293,7495,19355,1754,13682,16062,14686,14838,18547,9423,1850,15486,6230,4669,1431,11050}

    76

    33

    3541

    Returns: 18879.434210526328

  72. {3807,4094,6729,40,5325,5835,6689,3287,2279,2423,243,6251,927,6705,5953,1099,5349,4953,6436,3959,2438,1417,2707,6626,2909,1197,4857}

    {17667,10513,7953,16444,3090,11022,15826,2280,19845,2846,2621,2059,3765,9753,13391,9146,9119,18172,7938,7009,90,8706,7746,19435,10163,5337,11642}

    6

    607

    6985

    Returns: 353434.3333333334

  73. {2361,7411,6222,9193,9219,4063,5761,4677,8636,2459,8430,3126,1001,4119,3841,3053,4911,6666,8618}

    {16465,327,5352,8887,13651,16110,12337,7017,9023,4538,564,12554,18754,15091,6290,14357,10239,14612,19006}

    566

    12

    9385

    Returns: 6103.392226148417

  74. {4572,8859,7291,7377,2029,2451,4472,4129,3372,1236,9771,8418,1350,1928,1292,2407,6916,4347,5970,7104,8403,6146,8700,976,4849}

    {9952,15180,9872,9528,8974,7157,8722,12291,7349,15902,17887,11356,14582,16255,10435,5222,14222,15644,18573,9175,3810,9252,13701,5805,12461}

    62

    70

    9940

    Returns: 508638.11290322576

  75. {878,2382,3356,2530,2654,2283,1005,2572,3296,2287,204,72,3343,3285,1768,1307,317,3322,2633,268,94,1227,906,3013,1909,257,3243,2068,279,3352,479,1676,709,3111,3264,158,1675,1145,1693,287,277,3147,1925,854,1201,2103,2386,610,1379,2056}

    {10905,6956,13164,6445,802,14949,12066,10204,9582,8660,6954,5537,10821,1035,7610,517,1642,19981,19978,7625,4799,385,16148,7427,7355,6655,12510,3230,16869,1872,1671,10841,19008,4383,1933,15451,5645,10630,6357,9633,7402,15589,12163,4780,1483,10351,17525,1565,17040,2526}

    28

    32

    3454

    Returns: 95822.46428571429

  76. {4586,1060,1575,3610,3516,250,4187,968,3949,4166,1029,3845,4143,2418,3863,5191,4140,6641,3243,716,4811,3445,3913,1772,709,4357,4985,253,5525,1136,4004,4177,5391,1984,2930,3383,1962,7321,6105,3918,5698,4691,5555,808,4924,3069}

    {91,2310,9134,11022,17433,12039,14737,234,11531,12307,1062,496,1971,1075,11436,14016,9482,14128,14281,6029,8666,17485,376,16117,511,8813,17621,2582,9917,2651,1160,8589,2918,9140,15664,14757,8628,17043,4910,7193,16156,209,14099,6607,12282,14879}

    394

    5

    7375

    Returns: 9644.86040609138

  77. {6462,1806,3985,5417,2894,2359,2191,3025,458,4102,3918,6992,3758,5344,38}

    {12482,8919,5285,3618,16564,14065,4016,3103,18553,17443,12049,5335,2726,12495,18214}

    12

    603

    8238

    Returns: 227620.9999999998

  78. {2758,4214,4402,3946,2050,3565,3810,5,1854,1167,2688,215,2530,1370,658,4136,2555,4129,2628,3640,3029,2347,1754,3132,2317,1581,296,1184,1414,448}

    {4103,76,6758,14469,3413,13879,3152,17524,16030,14707,10407,9924,8988,16599,11773,19336,14491,11776,6534,14885,15054,16387,14866,7391,16198,18731,19250,7101,3734,1204}

    32

    66

    4507

    Returns: 190666.1875

  79. {2258,6106,4485,3355,6128,3071,1933,6219,2027,2617,4766,4082,1789,4422,3213,285,2279,1201,3195,2611,3188,5339,5859,881}

    {13185,1942,3668,7086,2866,1998,15758,3506,11123,14846,10515,7218,10784,15198,13448,10405,4457,2942,5264,8334,8753,2816,5155,3798}

    86

    41

    6309

    Returns: 64524.02325581399

  80. {1737,6878,3727,3227,5065,4745,5650,5756,1546,728,323,6141,8220,7374,6432,3960,7575,4322,8218,5644,5209,471,5559,7925,5463,8944,2143,7861,3837}

    {10205,10625,10762,13856,6220,8124,3397,14612,16606,14065,13229,13622,8284,19546,6282,9783,11505,2286,17915,19829,16330,19504,15050,13045,2809,4177,6589,19197,18536}

    283

    15

    9136

    Returns: 41730.544169611305

  81. {4755,4752,2539,412,2978,3958,7422,1349,2376,5444,4933,655,3691,7452,5374,1875,7826,203,7642,4735,543,4949,1595,1126,7278,6952,327,4646,6956,2872}

    {5262,1155,3498,3041,8727,5029,16217,8757,908,10442,4766,19225,7578,5869,7624,1045,10463,11137,14761,19450,7785,10472,11760,19364,14601,3236,6745,15019,1862,19142}

    49

    40

    7933

    Returns: 193169.2040816326

  82. {2333,3242,5140,7774,3983,5853,2748,251,481,183,6495,1844,2373,712,3628,4612,3413,7330,7504,7523,3090,986,6272,7053,1859,6868,4233,1978,1267,7014,3258,1474,3993,5372,5570,2771,7331,5915,1127,5378,7556,724,6206,3312,7793}

    {981,6503,12672,19957,15857,7164,1996,2589,14889,1218,17513,8994,7469,4523,2897,3311,10323,8970,13285,2800,11677,3288,14515,253,16981,8552,5367,6145,16153,5925,19531,17801,10500,4172,16536,2482,270,14131,9061,399,19317,5286,11432,5276,14678}

    22

    290

    7812

    Returns: 20934.272727272713

  83. {1233,166,4227,5573,4807,2394,7433,3647,2172,7661,4442,1429,7045,1556,2230,3409,878,386,2529,4887,5798,6705,681,5778,3619,2222,3904,2062,7965,6605,7140,2195,391,5264,2306,7720,8274,8295,5926,6050,6003,4345,2338,7290,4626,4791,502}

    {16909,5120,10914,3052,13637,10631,992,16824,14777,9070,6859,10461,4537,18199,7293,2585,3005,18179,5501,6581,6042,4100,5296,419,18716,8155,7803,261,13924,7174,7668,17549,16927,16949,7512,6769,2400,16127,17849,404,10318,8205,8487,12069,17083,13390,3399}

    17

    416

    8412

    Returns: 20572.94117647065

  84. {5584,2501,2776,4063,5627,2257,2435,6718,2082,1407,7256,503,10,3787,5392,7955,6659,2439,2777,2709,3716,4926}

    {10406,19277,16311,4262,16191,19448,5860,6019,18774,6378,17623,15401,7986,17204,18334,16053,19576,1358,13375,12052,8234,5879}

    965

    4

    8122

    Returns: 11817.17202072539

  85. {3261,2907,2366,4610,4606,206,3297,5374,2962,3425,5934,5737,1062,5079,1669,3931,5595,5506,3287,5846,4811,519,4469,4927,2592,3064,2593,3961,1304,3661,935,293,865,1179,5061,4108}

    {7955,4984,16163,18608,19920,14135,17780,10522,5911,610,5662,12869,3572,723,729,9835,10081,3001,3199,7524,5290,19026,12612,14106,2322,12421,12283,1554,6116,15814,1709,3390,13208,9556,18992,17837}

    13

    422

    6269

    Returns: 36740.76923076933

  86. {3642,1646,1084,1232,1256,631,1255,1384,4353,3472,2476,1912,3047,1681}

    {12088,6059,9634,3037,473,9868,11001,9871,19524,2106,9740,14197,5522,8450}

    568

    6

    4790

    Returns: 1513.105633802819

  87. {3214,1256,1750,5597}

    {17520,19885,6690,11793}

    79

    61

    6270

    Returns: 122875.82278481012

  88. {1006,2159,2818,1392,3223,2664,5007,4049,1384,4502,1238,4481,3564,714,259,3682,395,3719,1989,1452,3894,2069,2556,2738,736,1630,4381}

    {19718,4982,196,15901,13172,7583,12424,769,10024,6818,7803,1813,6139,13640,8322,14688,15881,14070,6708,3474,1507,3091,18205,17980,6320,7087,6948}

    29

    111

    5022

    Returns: 12185.79310344833

  89. {3471,2754,3960,2841,2052,1901,1387,5087,4499,4054,3148,4973,5053,3731,3509,1075,2015,4967,2205,3705,1440,962,1522,22,671,1997,2328,1841,1855,950,5203,1686,119,305,2182}

    {10910,1820,2552,16899,1892,14726,7057,15752,2104,19560,14629,832,1152,17807,7575,11475,12137,8853,12478,17305,13658,9450,4361,16782,6844,131,11551,11042,3948,2853,19313,9265,4639,18406,4928}

    114

    18

    5207

    Returns: 19170.20175438597

  90. {2230,3332,1038,3180,3854,1709,3483,782,3003,548,2709,3563,402,112,3892,930,996,1384,2004,3658,2460,893,1459,1025,2639,2223}

    {14305,1306,1942,18643,12431,397,4880,19422,1015,4597,10955,15101,9241,18769,16488,6979,2708,6834,19789,5899,3501,8458,12899,2771,18469,15313}

    1

    790

    4010

    Returns: 5527186.0

  91. {2589,5680,4134,4628,495,5871,1143,4412,1869,5612,4402,1338,1026,2249,1839,2394,699,1001,3119,1039,4723,2484,4126,5584,2257,5353,3297,395,3388,2068,3389,4977,708,2039,4534,567,6003,2980,4744,114,1412,202,1624,3449}

    {12799,18198,8782,6691,4937,11492,14555,1886,1594,9578,6440,9546,8616,2212,13589,8925,2854,11707,3353,13510,15932,8848,220,2506,4982,16050,6589,3924,19477,3549,10351,9607,16335,8630,6255,283,17039,14138,18685,3491,12565,10936,13040,19193}

    772

    2

    6175

    Returns: 7280.891191709844

  92. {2035,1247,1018,1231,3535,2421,325,2875,3476,2575,3051,3161,3481,3330,3556,3664,3328,1055,3609,2346,3388,2286,119,3535,2969,1635,988,909,2495,3109,288,90,759,73,109,3415,2547,3122,1655}

    {3732,15808,18703,2757,19036,8153,12420,428,16675,7865,13682,2691,13406,16431,11137,16635,14900,9316,14959,14666,1917,10162,12124,7907,4459,2103,17130,11706,7599,11806,14376,11334,4001,3630,9032,13132,9300,174,2420}

    2

    305

    3785

    Returns: 4448449.5

  93. {1529,7557,3392,3885,1372,2482,7017,7516,3135,6584,6991,1491,7186,7484,4617,4380,4000,68,428,1719,5739,5608,871,401,3198,4728,7448,1080,3356,5574,4231,4466,7251,4354,3745,6599,4697,1468,6432,1470,4244,7092,6409,4433}

    {19293,571,14680,3507,19025,9952,17094,9028,12777,14545,17804,18350,13315,2971,12825,9862,10732,16444,2262,4080,7956,12184,16502,5035,11036,17114,17541,10681,16251,7433,14844,1126,16485,8860,7912,6182,2699,1269,7638,139,12160,3589,16419,16055}

    47

    114

    7604

    Returns: 22383.42553191486

  94. {524,4435,3070,981,3391,2459,3385,3120,2153,4007,4028,304,3825,4744,4693,3656,3422,859,3958,4819,487,5193,4142,5090,3495,414,685,4379}

    {15244,11137,2434,16865,10516,14694,2308,14900,7854,10981,3118,17719,15135,18614,12581,19859,7149,2249,16618,12993,9384,19575,13140,16550,2322,3594,19305,10376}

    17

    270

    5344

    Returns: 99749.76470588235

  95. {9737,6775,3492,3394,2864,662,5576,6540,7642,1646,157,4583,4871,4882,8438,3290,8237,6417,1746,303,4521,5532,1697,7041,7341,9256,9312,3469,4116,3323,627,5081,874,6592,105,8779,6967,1210,2472,4254,1439,3308,5054,497,935,6438,826,1230,2322}

    {8643,10546,6535,17472,15451,1506,7787,19584,6432,14166,1573,13323,18765,17607,8792,11427,3239,1278,4009,705,16142,12083,9418,16872,17551,18263,13391,17510,2954,2542,11252,1674,19795,19460,15707,18132,17657,13436,14277,17240,16982,573,15999,16789,18915,110,4977,3190,16105}

    5

    792

    9871

    Returns: 359504.8

  96. {2190,1131,3282,3387,862,4528,1826,1431,4527,650,3399,4230,4961,1419,66,642,799,1858,3378,1818,1996,5129,1154,2390,1893,3333,2304,3621,1596,332,4476,3883,3024,1259,2544,4658}

    {14094,19566,19571,16440,12616,9837,12708,14226,7283,1089,8268,13135,14685,2857,3449,9152,7413,5975,8620,13478,12554,8051,11900,6829,14383,17358,7379,19492,9953,3742,15992,17943,6601,13963,19001,8280}

    501

    5

    5187

    Returns: 21890.483033932134

  97. {4548,7653,1944,1877,5919,2740,8671,881,4238,5175,8696,499,6526,1385,4181,416,5222,267,2913,4735,7097,4532,6753,7531,3972,2563,4249,8515,5320,7253,8625,5148,4866,1178,4266,8742,604,8326,7162,2620,1301,4688,5817,6816,6716}

    {15977,17966,19022,13549,6877,2540,11802,15941,2837,7289,17761,14350,4420,18552,3848,8558,3375,9551,9921,4197,19453,11433,14218,297,8650,7227,17701,15887,12093,18093,1851,4367,5880,14224,8210,3389,353,19640,15147,19262,19163,3201,14320,14212,13982}

    75

    96

    9066

    Returns: 7636.506666666668

  98. {7126,22,206,3246,4556,5684,1625,7968,3904,5848,6730,4908,2285,425,1415,6115,3026,731,5112,1630,1748,2879,3473,4345,367,3563,2768,494,3461,464,7334,7350}

    {8052,442,8902,7645,18377,17939,15862,13472,4051,19764,17638,5862,13730,18943,3155,19056,6611,15648,8457,1388,5711,14804,607,8167,14017,6545,1469,7565,8444,2805,17072,1296}

    450

    17

    8155

    Returns: 673.122222222221

  99. {6102,467,6379,7439,621,3774,5877,252,2860,1935,2445,7706,4752,1571,7351,2292,7466,2671,1829,4890,5153,4890,351,7203,5032,6933,1187,1275,7278,6149,5437,5798,1865,4024,1015}

    {8657,11131,4637,4099,6253,13214,3441,18955,9469,15964,18529,16088,18916,1236,1588,8527,10415,15179,8745,18749,10122,9639,2781,7138,14305,2904,2687,15409,15334,18897,11771,5819,16890,6543,999}

    6

    807

    7737

    Returns: 886226.8333333333

  100. {951,2152,7820,744,6699,7115,5688,7048,5965,5486,4794,4632,1932,2149,6200,2905,880,8624,667,2593,422,4590}

    {2638,6268,8418,4434,14512,3785,1035,8564,12131,14266,11858,18605,17423,4648,13162,3453,2982,12087,7770,4945,13051,7595}

    16

    333

    8828

    Returns: 262473.75

  101. {1500,4500}

    {6000,8000}

    80

    40

    6400

    Returns: 282500.0

    {1552,4580} {6773,8477} 79 40 5256

  102. {100,400}

    {1549,1649}

    25

    16

    600

    Returns: 12792.0

  103. { 50, 100, 150, 200 }

    { 1000, 2000, 3000, 4000 }

    10

    10

    250

    Returns: 30000.0


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: