今天朋友讨论的一个小代码 输入小的数字 还可以运行 大一点的数字就会报错
请问大家该如何修改?!谢谢!换一种更好的写法也可以!public class jianmo {
  static long count = 0;  public static long jech(long a) {
    long s = 1;
    for (long i = a; i > 0; i--)
      s *= i;
    return s;  }  public static void main(String[] args) {
    int n = Integer.parseInt(args[0]);
    int t;
    int x;
    int y;
    jianmo j = new jianmo();
    for (t = 0; t <= n; t++)
      for (x = 0; x <= n; x++)
        for (y = 0; y <= n / 2; y++) {
          if (x + 2 * y == n & x + y == t) {
            try{            count = count + j.jech(t) / (j.jech(t - x) * j.jech(x));            }catch(ArithmeticException e){
              System.out.println(e.getMessage());
            }
           
            // System.out.println(x + "," + y + "," + count+","+t);
          }
        }
    System.out.println(count);
  }
}