Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. Problem Statement
  2.  
  3. ***Note: Please keep programs under 7000 characters in length. Thank you
  4.  
  5.  
  6.  
  7. Class Name: HowEasy
  8. Method Name: pointVal
  9. Parameters: String
  10. Returns: int
  11.  
  12. TopCoder has decided to automate the process of assigning problem difficulty
  13. levels to problems. TopCoder developers have concluded that problem difficulty
  14. is related only to the Average Word Length of Words in the problem statement:
  15.  
  16.  
  17. If the Average Word Length is less than or equal to 3, the problem is a 250
  18. point problem.
  19. If the Average Word Length is equal to 4 or 5, the problem is a 500 point
  20. problem.
  21. If the Average Word Length is greater than or equal to 6, the problem is a 1000
  22. point problem.
  23.  
  24. Definitions:
  25. Token - a set of characters bound on either side by spaces, the beginning of
  26. the input String parameter or the end of the input String parameter.
  27. Word - a Token that contains only letters (a-z or A-Z) and may end with a
  28. single period. A Word must have at least one letter.
  29. Word Length - the number of letters in a Word. (NOTE: a period is NOT a letter)
  30.  
  31.  
  32. The following are Words :
  33. "ab", "ab."
  34.  
  35.  
  36. The following are not Words :
  37. "ab..", "a.b", ".ab", "a.b.", "a2b.", "."
  38.  
  39.  
  40. Average Word Length - the sum of the Word Lengths of every Word in the problem
  41. statement divided by the number of Words in the problem statement. The
  42. division is integer division. If the number of Words is 0, the Average Word
  43. Length is 0.
  44.  
  45. Implement a class HowEasy, which contains a method pointVal. The method takes
  46. a String as a parameter that is the problem statement and returns an int that
  47. is the point value of the problem (250, 500, or 1000). The problem statement
  48. should be processed from left to right.
  49.  
  50. Here is the method signature (be sure your method is public):
  51. int pointVal(String problemStatement);
  52.  
  53. problemStatement is a String containing between 1 and 50 letters, numbers,
  54. spaces, or periods. TopCoder will ensure the input is valid.
  55.  
  56. Examples:
  57.  
  58. If problemStatement="This is a problem statement", the Average Word Length is
  59. 23/5=4, so the method should return 500.
  60. If problemStatement="523hi.", there are no Words, so the Average Word Length is
  61. 0, and the method should return 250.
  62. If problemStatement="Implement a class H5 which contains some method." the
  63. Average Word Length is 38/7=5 and the method should return 500.
  64. If problemStatement=" no9 . wor7ds he8re. hj.." the Average Word Length is 0,
  65. and the method should return 250.
  66. Definition
  67.  
  68. Class:
  69. HowEasy
  70. Method:
  71. pointVal
  72. Parameters:
  73. String
  74. Returns:
  75. int
  76. Method signature:
  77. int pointVal(String param0)
  78. (be sure your method is public)
  79.  
  80.  
  81.  
  82. 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)2003, TopCoder, Inc. All rights
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement