Skip to content

Instantly share code, notes, and snippets.

@cocodrips
Last active December 25, 2015 16:49
Show Gist options
  • Save cocodrips/7008271 to your computer and use it in GitHub Desktop.
Save cocodrips/7008271 to your computer and use it in GitHub Desktop.
SRM587 Div2 500 高々最初の1ステップをとどまるかとどまらないかを調べるだけ
/*__SRM587 Div2 500__*/
public class JumpFurther {
public int furthest(int N, int badStep) {
int step = 0;
for (int i = 1; i <= N; i++) {
step += i;
if (step == badStep) {
step--;
}
}
return step;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment