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

Re:直接这样调用函数,为什么不行呢?得不到正确的结果。

Posted by y05zyg at 2006-08-18 10:46:40 on Problem 2696
In Reply To:直接这样调用函数,为什么不行呢?得不到正确的结果。 Posted by:90503109 at 2005-12-31 17:48:58
> #include <stdio.h>
> int a,b,c,d,e,f,g,h;
> int function(int i)
> {
> 	int result;
> 	if (i==0) result=a;return result;
> 	if (i==1) result=b;return result;
> 	if (i==2) result=c;return result;
> 	if (i>=3 && (i%2)==0) 
> 	{
> 		result=d*function(i-1)+e*function(i-2)-f*function(i-3)%g;
> 		return result;
> 	}
> 	if (i>=3 && (i%2)==1)
> 	{
> 		result=f*function(i-1)-d*function(i-2)+e*function(i-3)%h;
> 		return result;
> 	}
> }
> 
> void main()
> {
> 	int n,k,i,s;
> 	scanf("%d",&n);
> 	for (k=1;k<=n;k++)
> 	{
> 		scanf("%d %d %d %d %d %d %d %d %d",&a,&b,&c,&d,&e,&f,&g,&h,&i);
> 		s=function(i);
> 	printf("%d\n",s);
> 	}
> }

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