Revision: 36585
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 23, 2010 22:04 by evandrix
Initial Code
import java.util.*;
public class HowEasy {
public int pointVal(String problemStatement) {
StringTokenizer st = new StringTokenizer(problemStatement, " ");
int totalChars = 0, numTokens = 0;
while(st.hasMoreTokens()) {
String t = st.nextToken();
if (t.matches("[A-Za-z]+\\.?"))
{
totalChars += t.endsWith(".") ? t.length() - 1 : t.length();
numTokens++;
}
}
int average = numTokens != 0 ? totalChars / numTokens : 0;
return (average <= 3) ? 250 : (average == 4 || average == 5) ? 500 : 1000;
}
}
Initial URL
http://www.topcoder.com
Initial Description
Initial Title
TopCoder Inv 2001 R1
Initial Tags
Initial Language
Java