import java.util.*;
import java.math.*;
//rename the class name before submitting
public class KeyDungeonDiv2 {
public static void main(String[] args) {
KeyDungeonDiv2 obj = new KeyDungeonDiv2();
System.out.println(
obj.countDoors(
null, null, null
));
}
public int countDoors(int[] doorR, int[] doorG, int[] keys) {
int n = doorR.length;
int cnt = 0;
for (int i = 0; i < n; i++) {
int kwhite = keys[2];
if (keys[0] < doorR[i]) {
kwhite -= doorR[i] - keys[0];
}
if (keys[1] < doorG[i]) {
kwhite -= doorG[i] - keys[1];
}
if (kwhite >= 0)
cnt++;
}
return cnt;
}
}
No comments:
Post a Comment