TopCoder SRM602: TypoCoderDiv2
色が変わる節目の個数を数える。
public class TypoCoderDiv2 { public int count(int[] rating) { int ans = 0; int current = 500; foreach (var r in rating) { if (current >= 1200 ^ r >= 1200) ans++; current = r; } return ans; } }
色が変わる節目の個数を数える。
public class TypoCoderDiv2 { public int count(int[] rating) { int ans = 0; int current = 500; foreach (var r in rating) { if (current >= 1200 ^ r >= 1200) ans++; current = r; } return ans; } }