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:It's my programme with the explanation.

Posted by 2006011417 at 2007-03-05 11:05:52 on Problem 1243
In Reply To:It's my programme with the explanation. Posted by:fxzy at 2006-02-21 11:35:00
> #include <stdio.h>
> int guess[31][31];    
> int get(int a,int b)
> {
>   if(a<0||b<0) return 0;  //a,b越界,则没猜到,即为0
>    else return guess[a][b];    
> }
> int main()
> {
>        int G,L,i,j,cas=0;
> 	for(i=1;i<=30;i++)
>      for(j=0;j<=30;j++)
>      	guess[i][j]=1+get(i-1,j-1)+get(i-1,j);//get(i-1,j-1)是猜大了,get(i-1,j)是猜小了,+1是猜对
> 	while(1)
>     {
> 	  scanf("%d%d",&G,&L);
> 	  if(G==0&&L==0) return 0;
> 	   printf("Case %d: %d\n",++cas,guess[G][L]);
> 	}
> }

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