此题调得我要死了 调了3个小时的java 还是从凌晨开始 我艹!!!!!还是runtime error 我都把所有数据输出来了。我觉得是我new太多的原因但是这个不用大数new根本做不了啊 我艹。。。
我真的想骂人了。。。
求大神改错:
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
//int test= cin.nextInt();
int c[]=new int[11];
c[0]=6;
c[1]=2;
c[2]=5;
c[3]=5;
c[4]=4;
c[5]=5;
c[6]=6;
c[7]=3;
c[8]=7;
c[9]=6;
c[10]=6;
//{6,2,5,5,4,5,6,3,7,6};
String d[]=new String[550];
for(int i=1;i<550;i++)
d[i]="0"+"";
d[0]="0"+"";
d[2]="1"+"";
d[3]="1"+"";
d[4]="1"+"";
d[7]="1"+"";
d[6]="2"+"";
d[5]="3"+"";
String no1="1"+"";
String no0="0"+"";
BigInteger t3=new BigInteger(no1);
BigInteger t0=new BigInteger(no0);
for(int i=2;i<500;i++)
{
BigInteger t2=new BigInteger(d[i]);
BigInteger t4=new BigInteger(d[i-1]);
//BigInteger t1=new BigInteger("0");
for(int j=0;j<10;j++)
{
int temp=i+c[j];
BigInteger t1=new BigInteger(d[temp]);
t1=t1.add(t2);
d[temp]=t1.toString();
}
if(i==6)
{
t2=t2.add(t3);
}
t2=t2.add(t4);
d[i]=t2.toString();
}
int n;
String tt;
Scanner cin= new Scanner(System.in);
n=cin.nextInt();
while(n>0)
{
if(n<=2000)
System.out.println(d[n].toString());
n=cin.nextInt();
tt=Integer.toString(n);
if(tt==null)break;
}
cin.close();
}
}