Statistics

Problem Statement for "Soccer"

Problem Statement

In soccer leagues, the winner of a match is awarded with 3 points and the loser 0 points. In case of a tie, both teams are awarded with 1 point each.

Create a class Soccer containing the method maxPoints which takes a int[] wins, the number of wins for each team in the league, and a int[] ties, the number of ties for each team in the league and returns an int, the maximum points a team in the league has. The i'th elements of wins and ties correspond to the number of wins and ties respectively for team i.

Definition

Class:
Soccer
Method:
maxPoints
Parameters:
int[], int[]
Returns:
int
Method signature:
int maxPoints(int[] wins, int[] ties)
(be sure your method is public)

Notes

  • Two or more teams may have the same number of points.

Constraints

  • wins will contain between 1 and 50 elements, inclusive.
  • ties will contain between 1 and 50 elements, inclusive.
  • wins will contain the same number of elements as ties.
  • Each element in wins will be between 0 and 100, inclusive.
  • Each element in ties will be between 0 and 100, inclusive.

Examples

  1. {1,4,3,0,0}

    {3,1,5,3,1}

    Returns: 14

    The number of points for each team are: Team 0: 3*1 + 1*3 = 6 points Team 1: 3*4 + 1*1 = 13 points Team 2: 3*3 + 1*5 = 14 points Team 3: 3*0 + 1*3 = 3 points Team 4: 3*0 + 1*1 = 1 point So team 2 has the most number of points, 14. The method should thus return 14.

  2. {12,45,20,17,48,0}

    {48,10,53,94,0,100}

    Returns: 145

    Both team 1 and team 3 got 145 points, which is the maximum.

  3. {35,0}

    {0,76}

    Returns: 105

  4. {0,0,0,0}

    {0,0,0,0}

    Returns: 0

  5. {13,79,26,73,14,89,71,37,89,71,19,59,39}

    {88,27,5,70,84,94,20,50,2,11,31,22,50}

    Returns: 361

  6. {14,13,15,56,71,13,21,39,87,40,54,14,34,13,27,27,0,86,0,44,76,75,62,6,64,63,60,89,1,46,7,83,20,84,16,93,18,18,77,85,90,84,12,19,74,100}

    {40,46,27,55,45,61,73,50,15,68,51,47,47,79,26,48,13,46,75,15,0,90,30,45,82,66,55,94,59,29,6,4,57,10,82,56,6,91,5,29,1,19,88,31,93,17}

    Returns: 361

  7. {44,5,95,89,37}

    {18,68,29,100,75}

    Returns: 367

  8. {23,68,38,42,54,51,71,74,43,51,59,73,60,74,3,61,90,23,98,48,51,14,97,69,76}

    {28,79,85,78,26,42,73,63,46,7,28,52,40,84,60,41,76,63,12,17,95,44,45,61,49}

    Returns: 346

  9. {78,33,56,13,67,32,37,25,33,18,0,49,42,51,31,16,88,31,17,26,37,82,0,39,51,81,80,53,6,76,85,76,51,47,4,91,35,81,4,43,40,64,36,54,59,83,7,88}

    {56,20,58,4,30,29,20,46,26,39,23,60,42,7,37,69,21,59,80,81,18,87,78,4,20,48,67,10,21,56,55,45,95,55,95,6,39,70,41,54,91,33,4,18,44,74,86,47}

    Returns: 333

  10. {35,19,75,77,35}

    {44,87,45,10,59}

    Returns: 270

  11. {79,60,21,100,1,9,72,42,37,46,68,43,62,66,7,35,50,12,58,91,66,0,68,36,83,99,31,17,3,72,50,90,30,22,100,8,85,83,76,94,48}

    {100,56,50,24,52,21,60,2,52,39,83,78,44,54,78,65,56,93,61,48,17,47,48,71,62,26,75,21,36,54,67,72,76,13,40,98,1,93,46,71,50}

    Returns: 353

  12. {44,96,80,25,11,53,74,11,58,97,42,20,90,54,87,73,66,17,7,71,72,74,98,65,25,10,30,51,29,23}

    {99,45,99,52,89,50,62,50,63,30,59,0,68,57,47,36,13,61,7,52,31,41,45,51,88,86,71,13,21,87}

    Returns: 339

  13. {70,89,0,79,2,79,20,34,31,24,98,84,57,37}

    {68,61,51,44,98,31,53,73,1,66,83,18,54,1}

    Returns: 377

  14. {17,15,91,3,22,54,12,63,92,89,73,66,40,54,40,100,90,77,41,95,85}

    {15,92,29,19,84,7,53,49,9,44,26,39,47,56,34,67,32,12,8,15,15}

    Returns: 367

  15. {31,29,52,27,96,94,96,24,89,45,69,92,50,86,21,72,41,29,86,54,56,60,0,13,58,6,66}

    {66,11,10,50,7,2,40,67,67,92,3,77,22,95,30,15,95,5,3,29,99,51,96,20,38,3,100}

    Returns: 353

  16. {77,93,84}

    {53,49,70}

    Returns: 328

  17. {49,22,18,27,99,97,64,0,9,1,92,35,1,86,54,60,4,88,58,28,15,75,21,24,14,76,67,11,75,15,71,92,95,69,50,72,3,15,48,70}

    {37,78,35,2,71,99,94,81,96,97,32,19,6,34,15,14,84,37,7,92,0,38,29,6,47,31,87,80,13,40,39,58,89,77,14,90,1,43,37,64}

    Returns: 390

  18. {45,85,5,52,53,37,12,47,66,88,49,49,73,59,5,90,45,15,55,34,79,74,50,25,42,90,49,100,45,38,86,39,3,34,68,29,90,11,63,54,20,89,12,12,17,87,68,52,6,81}

    {24,71,58,76,63,11,86,23,99,95,23,35,75,7,71,10,48,74,33,21,1,29,10,74,80,39,38,74,8,59,61,56,81,56,14,84,44,52,24,65,45,36,74,17,77,57,76,14,79,20}

    Returns: 374

  19. {28,97,54,61,61,55,19,35,28,1,78,64,65,84,69,45,63,36,74,57,97,66,35,62,39,58,91,23,86}

    {46,9,39,68,42,33,33,37,88,17,68,19,30,57,2,50,1,8,94,45,25,44,86,79,4,55,26,49,22}

    Returns: 316

  20. {99,81,31,74,91,56,23,36,99,100,96,100,98,67,73,95,33,54,18,34,25,69,71,38,62,90,33,11}

    {62,15,52,6,5,64,8,82,95,34,34,53,37,43,80,60,24,76,65,73,22,54,71,40,74,4,4,10}

    Returns: 392

  21. {36,44,66,2,39,3,75,91,76,63,99,49,31,64,51,40,75,26,90,57,13,98,47,96,96,78,100,53,57,90,53,65,10,96,31,39,41,86,77,86,1,14,89,32}

    {79,31,14,39,90,55,28,12,53,62,68,39,13,23,27,38,38,80,73,40,64,39,7,20,58,82,69,87,91,4,96,65,21,42,26,6,17,98,22,39,71,35,12,93}

    Returns: 369

  22. {60,83,94,98,56,96,11,60,84,25,61,89,67}

    {12,70,82,39,14,96,95,97,8,55,85,94,0}

    Returns: 384

  23. {40,87,86,59,55,69,42,76,8,93,30,95,4,46,24,80,47,56,41,65,56,68,34,27,80,76,11,45,38,6,65,40,16,72,96,31,26,40}

    {10,23,85,34,8,24,34,86,1,38,32,86,70,48,47,80,8,2,76,4,32,35,7,15,48,52,88,66,39,11,44,78,18,66,78,87,10,94}

    Returns: 371

  24. {43,88,32,22,97,26,5,43,38,14}

    {20,40,24,87,70,25,51,45,3,56}

    Returns: 361

  25. {48,38,26,5,96,44,5,100,62,60,22}

    {80,22,7,51,82,4,7,66,84,73,3}

    Returns: 370

  26. {62,17,36,36,29,24,92,44,73,6,16,26,79,53,42,45,98,92}

    {38,2,44,52,82,2,33,85,89,49,91,45,55,57,34,52,3,81}

    Returns: 357

  27. {74,6,26,42,19,94,18}

    {64,54,65,9,98,3,63}

    Returns: 286

  28. {84,81,99,37,77,34,59,100,51,41,27,21,16,70,11,31,65,12,4,41,32,12,14,37,93,1,38,58,89,62,57,4}

    {13,37,85,93,57,53,79,42,36,54,31,54,93,27,30,12,22,99,91,6,38,94,16,61,60,71,97,35,88,62,55,55}

    Returns: 382

  29. {43,9,33,92,87,57,92,29,79,84,26,66,39,88,19,42,56,62,90,20,38,45,39,86,33,24,56,73,97,80,58,22,21,46,23,53,98,1,41,37,79,3,40,43,36,22,54,40}

    {23,43,29,32,6,96,53,24,67,2,27,72,71,16,70,30,91,47,31,24,31,51,4,57,5,72,100,32,100,0,21,86,57,54,44,77,79,35,100,61,14,92,97,96,47,10,87,63}

    Returns: 391

  30. {8,36,18,44,69,35,68,98,59,79,4,44,56,97,96,42,91,12,42,88,35,17,15,5,16,36,8,38,19,90,82,50,49,8,61,31,100,65,86,5,60,32,32,98,65,68,24,28,49,55}

    {57,75,43,27,51,30,76,74,52,27,36,82,32,30,65,61,41,91,7,43,22,63,40,19,2,0,81,57,19,28,52,14,21,27,73,76,18,99,11,19,44,1,98,16,89,94,19,31,100,72}

    Returns: 368

  31. {52,91,72,76,67,69}

    {56,66,85,90,85,42}

    Returns: 339

  32. {81,38,37,97,81,56,67,22,93,99,28,48,2,27,65,23,78,25}

    {69,68,19,61,41,36,34,65,16,44,88,27,68,73,72,69,16,96}

    Returns: 352

  33. {73,65,0,28,57,57,72,90,21,59,85,5,84,8,69,62,91,7,57}

    {58,72,86,94,50,30,99,19,20,53,37,35,43,93,34,87,38,94,53}

    Returns: 315

  34. {62,88,35,48,98,99,64,7,40,30,21,49,77,15,83,21,41,99,62,99,16,86,47,8,78,70,25,6,49,34,53,84,40}

    {83,24,75,92,4,34,39,40,14,5,30,47,84,0,28,99,59,10,92,48,19,71,25,48,7,10,7,26,44,76,82,20,50}

    Returns: 345

  35. {52,53,87,99,63,41,14,12,2,46,68,37,76,50,50,86,68,34,0,40,90,12,68,65,70,56,52,41,60,65,15,13,29,53,70}

    {40,26,38,65,69,56,16,2,47,97,31,55,37,10,89,41,15,92,66,88,0,38,6,6,5,76,60,5,74,92,33,0,86,25,10}

    Returns: 362

  36. {33,62,58,30,46,70,100,72,62,63,82,84,81,76,28,47,1,44,33,64,53,30,42,38,77,67,59,43,96,80,1,60,61,26,12,74,17,21,28,12}

    {37,3,25,74,23,37,75,57,90,27,69,97,7,80,47,76,95,29,43,21,60,44,58,30,68,71,44,18,79,87,53,96,84,13,78,28,95,15,82,66}

    Returns: 375

  37. {60,96,94,8,6,75,44,20,89,32,42,96,86,24,83,7}

    {94,74,19,52,36,80,30,10,17,7,44,26,58,81,70,16}

    Returns: 362

  38. {68,32,89,52,34,69}

    {9,86,100,47,47,3}

    Returns: 367

  39. {51,6,89,16,36,52,43,40,64,79,33,87,85,77,23,86,86,74,43,34,97,87,2,14,8,55,100,62,4,75,56,33,31,34,46,63}

    {11,80,90,0,67,92,64,9,53,59,92,15,37,91,26,12,6,48,69,37,1,54,5,71,7,92,48,66,65,73,23,79,97,65,9,94}

    Returns: 357

  40. {41,20,89,34,94,95,34,3,41,73,87,48,63,61,86,46,10,90,51,50,18,12,59,86,6,11,34,92,29,72,70,70,97,97,19,52,82,48,10,68,47,52,58}

    {74,44,12,15,36,15,94,26,74,5,53,62,25,22,69,59,95,94,51,80,99,25,18,88,82,83,29,41,74,16,6,24,47,23,75,62,39,77,87,11,43,20,70}

    Returns: 364

  41. {64,78,12,52,66,1,85,62,47,78,0,13,75,72,74,30,99,17,0,79,81,92,35,61,8,54,77,68,90,87,22,25,24,11,22,32,20,26,29,77,100}

    {45,91,51,43,19,86,22,79,89,100,1,31,56,69,35,30,21,24,61,97,13,23,14,15,85,46,51,46,81,36,41,84,55,99,45,25,60,40,13,3,17}

    Returns: 351

  42. {37,92,70,33,21,87,46,54,85,46,17,51,52,14,17,15,31,97,32,75,58,81,9,78,8,82,58,24,28,68,41,82,80,99,78,99,2}

    {16,48,16,45,71,53,47,12,83,0,54,88,44,65,84,26,99,8,61,31,87,46,76,14,12,92,18,78,3,39,28,83,56,77,32,85,26}

    Returns: 382

  43. {94,2,40,54,72,8,54}

    {45,67,45,20,29,79,86}

    Returns: 327

  44. {54,77,95,95,63,46,56,83,91,82,33,16,81,97,93,6,9,9,59,74,12,95,81,3,95,93,32,67,35,46,7,42,10,50,98,81,8,72,36,66,1,44,29,31,18,50,64,76,45,71}

    {64,62,20,45,73,13,94,44,49,1,35,56,84,35,100,56,78,14,23,71,100,15,87,56,59,31,19,8,9,65,90,59,50,93,20,38,52,33,31,56,6,77,50,97,77,75,87,14,72,13}

    Returns: 379

  45. {62,52,76,66,31,40,34,77,14,53,69,98,42,90,45,48,8,36,93,23}

    {31,48,74,66,25,39,92,11,9,100,82,60,84,23,51,68,77,50,3,47}

    Returns: 354

  46. {24,29,37,83,39,22,92,98,91,54,49,56,74,62,75,32,95,98,76,3,14,54,85,76,25,15,30,99,71,13,22,51,31}

    {75,90,87,99,23,43,25,34,52,38,20,46,97,7,76,39,10,13,78,92,68,47,12,32,70,72,29,39,13,55,7,45,11}

    Returns: 348

  47. {47,90,6,75,69,3,99,53}

    {54,71,16,56,71,6,79,67}

    Returns: 376

  48. {42,98,2,40,85,50,7,30,94,51,60,35,38,71,56,62,83,80,13,43,43,72,46,86,52,78,43,80,0,73,82,49,12,68,31,77,8,39,62,0,34}

    {100,24,29,72,27,91,94,4,43,90,94,25,11,59,68,19,78,99,35,55,51,53,62,13,23,93,54,16,11,90,62,14,84,65,59,84,76,51,35,38,93}

    Returns: 339

  49. {63,64,93,4,99,30,25,18,72,84,55,15,1,20,19,22,74,6,80,35,3,89,7,1,91,74,6,75,88,26,51,92,43,21,5,95,66,96,40,40,51,33,76,29,70,24,13}

    {14,46,100,23,3,38,55,99,30,70,54,11,96,48,64,79,12,60,99,48,75,69,47,21,19,48,51,38,23,36,41,14,90,54,50,89,89,44,7,73,86,49,95,100,29,24,38}

    Returns: 379

  50. {76,9,2,49,61,21,86,39,27,36}

    {40,30,33,57,61,87,49,78,4,58}

    Returns: 307

  51. {16,88,89,7,21,65,2,99,15,96,19,41,23,9,10,19,31,60,51}

    {81,37,33,90,45,88,51,42,84,90,13,0,50,3,23,25,19,34,95}

    Returns: 378

  52. {76,1,37,83,8,29,33,22,68,56,13,14,100,10,42,52,89,89,66,82,90,77,58,8,32,29,45,68,14,77,11,55,25,42,55,9,70}

    {4,11,83,58,45,98,86,2,37,96,71,82,72,39,86,85,9,61,98,88,24,83,87,29,8,13,97,77,1,75,18,9,36,96,99,30,33}

    Returns: 372

  53. {39,79,87,0,51,96,29,98,69,20,96,89,18,53,89,72,53,39,25,32,52,63,9,21,35,4,84,30}

    {24,2,57,27,19,98,22,56,72,87,47,47,85,100,68,83,48,3,70,46,62,21,75,95,8,87,55,35}

    Returns: 386

  54. {32,58,88,39,59,21,1,2,29,56,6,89,79,39,38,62,60,30,85,22,91,76,41,26,38,14,84}

    {52,19,98,91,68,20,50,15,81,61,28,79,30,62,82,75,10,42,56,80,100,13,57,46,34,15,11}

    Returns: 373

  55. {92,44,91,84,85,38,76,78,15,79,26,91,52,12,100,32,38,45,50,40,1,60,71,79,25,65,87,17,67,13,5,50,82,20,48,94,85,43,30,48,57,6,92,52,63,72}

    {40,22,98,34,68,26,72,46,39,77,13,12,23,20,31,89,21,60,13,4,44,72,18,23,58,13,28,28,77,80,32,96,4,24,11,93,18,65,25,39,28,17,37,7,94,2}

    Returns: 375

  56. { 1, 2 }

    { 1, 1 }

    Returns: 7

  57. { 1, 0 }

    { 1, 0 }

    Returns: 4

  58. { 0, 5, 0 }

    { 0, 10, 0 }

    Returns: 25

  59. { 1 }

    { 1 }

    Returns: 4

  60. { 1, 2 }

    { 1, 1 }

    Returns: 7

  61. { 1, 0 }

    { 1, 0 }

    Returns: 4

  62. { 0, 5, 0 }

    { 0, 10, 0 }

    Returns: 25

  63. { 1 }

    { 1 }

    Returns: 4


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: