P1
pujiaxun opened this issue · comments
Jason commented
数据精度并不够呀~
我一开始调试的时候long也会溢出,不知道在C++里面用什么,希望学长能够指点一下~~
下面是Java代码:
import java.math.BigInteger;
public class Fibonacci {
public static void main(String[] args) {
BigInteger a = BigInteger.ONE;
BigInteger b = BigInteger.ONE;
for (int i = 0; i < 50; i++) {
System.out.print(a + " " + b + " ");
a = a.add(b);
b = a.add(b);
}
}
}
Zewen (Evan) Li commented
我一开始调试的时候long也会溢出,不知道在C++里面用什么,希望学长能够指点一下~~
下面是Java代码:
import java.math.BigInteger;
public class Fibonacci {
public static void main(String[] args) {
BigInteger a = BigInteger.ONE;
BigInteger b = BigInteger.ONE;
for (int i = 0; i < 50; i++) {
System.out.print(a + " " + b + " ");
a = a.add(b);
b = a.add(b);
}
}
}
Jason commented
尝试过手动实现加法吗?
Servon-Lee <notifications@github.com>于2017年6月27日 周二22:02写道:
… 我一开始调试的时候long也会溢出,不知道在C++里面用什么,希望学长能够指点一下~~
下面是Java代码:
import java.math.BigInteger;
public class Fibonacci {
public static void main(String[] args) {
BigInteger a = BigInteger.ONE;
BigInteger b = BigInteger.ONE;
for (int i = 0; i < 50; i++) {
System.out.print(a + " " + b + " ");
a = a.add(b);
b = a.add(b);
}
}
}
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AMkUdsBO08BANQ2_GWarDhXR7K5IUjFSks5sIQtTgaJpZM4OEzpV>
.