Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

晕，贴错了

Posted by Leo at 2005-10-23 13:52:10 on Problem 2680
In Reply To:Re:不行！！大侠帮忙看看！ Posted by:Leo at 2005-10-23 13:36:36
```import java.io.*;
import java.util.*;
import java.math.BigInteger;

public class Main
{
public static void main(String args[])throws Exception
{
String input;
int number=0;
BigInteger array[]=new BigInteger[1001];
array[1]=new BigInteger("0");
array[2]=new BigInteger("1");
BigInteger one=new BigInteger("1");
BigInteger two=new BigInteger("2");
for(int i=3;i<=1000;i++)
{
if(i%2==0)
{
array[i]=array[i-1].multiply(two);
}
else
{
array[i]=array[i-1].multiply(two);
array[i]=array[i].subtract(one);
}
}
while(true)
{
try
{
Scanner cin=new Scanner(System.in);
if(cin==null) break;
number=cin.nextInt();
}
catch(Exception e)
{
break;
}
if(number==1)
{
System.out.println("0");
}
else if(number==2)
{
System.out.println("1");
}
else
{
System.out.println(array[number]);
}

}
}
}

```

Followed by: