[java]
public class Bonuses {
public int[] getDivision(int[] points) {
int total = 0;
int max = 0;
for(int point : points) {
total += point;
max = Math.max(max, point);
}
int[] division = new int[points.length];
for(int i = 0; i
int divtotal = 0;
for(int div : division)
divtotal += div;
int rest = 100 - divtotal;
loop:while(max > 0 && rest>0) {
for( int i=0; i
int plus = (points[i]==max) ? 1 : 0;
division[i] += plus;
rest -= plus;
}
max--;
}
return division;
}
}
[/java]
0 件のコメント:
コメントを投稿