過去ログ

kasama
おはようございます(*^_^*)

public class Question473 {
 public static void main(String[] args) {
  segment(0, 1, 1);
 }
 private static final void segment(int n, int red, int blue) {
  if (red > 2005 || blue > 1019) return;
  if (red == 2005 && blue == 1019) {
   System.out.println(n);
   return;
  }
  segment(n+1, red, blue+red);
  segment(n+1, red+blue, red);
 }
}
出先   10月20日(木) 9:21:28     26005

過去問題一覧へ戻る