// Topcoder SRM 579 DIV 2 L1 PrimalUnlicensedCreatures
import java.util.*;
import java.math.*;
//rename the class name before submitting
public class PrimalUnlicensedCreatures {
public static void main(String[] args) {
PrimalUnlicensedCreatures obj = new PrimalUnlicensedCreatures();
System.out.println(
obj.maxWins(
0, null
));
}
public int maxWins(int initialLevel, int[] grezPower) {
Arrays.sort(grezPower);
int cnt = 0;
for (int i = 0; i < grezPower.length; i++) {
if (initialLevel > grezPower[i]) {
initialLevel += grezPower[i] / 2;
cnt++;
}
else
break;
}
return cnt;
}
}
No comments:
Post a Comment