别再打了,Java和Python,你们其实都是C

  考试加上懒得写代码,休息了一个多周

  ……其实考试的因素很大啦……

  

  坐着火车不知道干什么好,研究了半天GUI,什么也没搞懂,加上终于学会用BigInteger了,就算了下斐波那契数列。

  然后我就发现了,在我电脑算到死机之前,Java和Python的速度差距很小。

BigInteger num1 = new BigInteger("1");
BigInteger num2 = new BigInteger("1");
BigInteger temp;
int count = 0;

while (count < 100000) {
    temp = num1;
    num1 = num2;
    num2 = temp.add(num2);
    
    count++;
}

System.out.println(num2);

 

  对的,算十万个秒出,算一百万个就卡住了……

  还是Python代码简单一点……

posted @ 2014-01-01 01:36  Chihane  阅读(140)  评论(0编辑  收藏  举报