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

这是我的核心部分,大家帮忙看看啊

Posted by tibelf at 2007-12-30 22:03:32 on Problem 3472
In Reply To:为什么老RE啊 Posted by:tibelf at 2007-12-30 21:56:39
bignum a[10010] ;
int main(){
	int n , m ;
	bignum sum ;
	int b[4000];
	while( cin >> n )
	{
		sum = 0 ;
		n += 2 ;
		a[0] = 1 , a[1] = 1 ;
		for( int i = 2 ; i < n ; i ++ )
			a[i] = a[i-1] + a[i-2] ;
		sum += ( a[n-2] * a[n-4] + a[n-3]*a[n-3] ) * ( a[n-2] * a[n-4] + a[n-3]*a[n-3] ) ;
		sum += a[n-2] * a[n-3] * a[n-3] * a[n-4] * 4 ;
		sum = sum * 2 + 2 ;
		m = 0 ;
		while( sum > 0 )
		{
			b[m++] = sum %1000 ;
			sum = sum / 1000 ;
		}
		cout << b[m-1] ;
		for( int i = m - 2 ; i >= 0 ; i -- )
		{
			if( b[i] > 100 )
				cout << "," << b[i] ;
			else if( b[i] > 10 )
				cout << ",0" << b[i] ;
			else
				cout << ",00"<< b[i] ;
		}
		cout << endl ;
	}
	return 0 ;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator