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 wlnutter at 2008-11-06 17:22:31 on Problem 1095
   用数学方法判断时最好把t[0]=1也放进去,我之前调试得呕血...
改良后发现想不正确都难...

t[0]=1;
for (i1=0;i1<19;i1++)
 for (j1=0;j1<=i1;j1++)
 t[i1+1]=t[i1+1]+t[j1]*t[i1-j1]; 
......
if (k==1) {printf("X"); return;}    
while (h+t[i]<=k)       
 {
 h+=t[i];      
 i++;      
 }      
l=--i;       
j=k-h;       
while (j-t[l]*t[i-l]>=0)       
 {      
 j-=t[l]*t[i-l];
 l--;      
 }
q=j/t[l]; 
h=0;
for (o=0;o<i-l;o++)
h+=t[o];
h+=q;
if (h>0)
{
printf("(");
decide(h);
printf(")");
}  
printf("X"); 
q=j%t[l];
h=0;
for (o=0;o<l;o++)
h+=t[o];
h+=q;
if (h>0)
{
printf("(");
decide(h);
printf(")");

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