public class A03分数之和 {
public static void main(String[] args) {
long x=1;
long y=1;
Rational r=new Rational(0, 1);
Rational r2;
for(int i=1;i<=20;i++){
r2=new Rational(x, y);//被加数
r=r.add(r2); //两个分数相加
//System.out.println(r);
y=y*2;//分母翻倍
}
System.out.println(r);
}
}