第1个回答 2016-01-28
public class Main
{
private static final int N = Integer.MAX_VALUE/32;
/**
*
*/
public Main()
{
// TODO Auto-generated constructor stub
}
/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
double sum=0;
double flag =1.0;
for(int i=0;i<N;i++)
{
double a =1.0/(i*2+1);
sum +=a*flag;
flag=-flag;
}
sum =sum *4;
System.out.println(sum);
}
}