uva11385

37 篇文章 0 订阅

此题调得我要死了  调了3个小时的java  还是从凌晨开始 我艹!!!!!还是runtime error  我都把所有数据输出来了。我觉得是我new太多的原因但是这个不用大数new根本做不了啊 我艹。。。


https://img-my.csdn.net/uploads/201301/12/1357943265_1970.jpg

我真的想骂人了。。。

求大神改错:

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();
	}
}



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值