public class YahtzeeScore {
public static void main(String args[]) {
new YahtzeeScore();
}
public YahtzeeScore() {
int[] t = { 5, 3, 5, 3, 3 };
System.out.println(maxPoints(t));
}
public int maxPoints(int[] toss) {
int[] points = new int[7];
for (int i = 0; i < points.length; i++) {
points[0] = 0;
}
for (int i = 0; i < toss.length; i++) {
points[toss[i]]++;
}
int ret=-1;
for(int i=1;i<points.length;i++){
if(ret<points[i]*i)
ret=points[i]*i;
}
return ret;
}
}
public static void main(String args[]) {
new YahtzeeScore();
}
public YahtzeeScore() {
int[] t = { 5, 3, 5, 3, 3 };
System.out.println(maxPoints(t));
}
public int maxPoints(int[] toss) {
int[] points = new int[7];
for (int i = 0; i < points.length; i++) {
points[0] = 0;
}
for (int i = 0; i < toss.length; i++) {
points[toss[i]]++;
}
int ret=-1;
for(int i=1;i<points.length;i++){
if(ret<points[i]*i)
ret=points[i]*i;
}
return ret;
}
}