Created
October 5, 2013 09:29
-
-
Save cocodrips/6838779 to your computer and use it in GitHub Desktop.
SRM588 Div2 250
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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