Skip to content

Instantly share code, notes, and snippets.

@cocodrips
Created October 5, 2013 09:29
Show Gist options
  • Save cocodrips/6838779 to your computer and use it in GitHub Desktop.
Save cocodrips/6838779 to your computer and use it in GitHub Desktop.
SRM588 Div2 250
public class KeyDungeonDiv2 {
public int countDoors(int[] doorR, int[] doorG, int[] keys) {
int open = 0;
for (int i = 0; i < doorR.length; i++) {
int r = doorR[i];
int g = doorG[i];
int w = keys[2];
r = r - keys[0];
g = g - keys[1];
if (r > 0) w -= r;
if (g > 0) w -= g;
if (w >= 0) open ++;
}
return open;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment