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 gemenhao at 2006-07-26 09:16:01 on Problem 2229
In Reply To:这程序有什么错误吗??高手指教一下 Posted by:houxuanfelix at 2006-07-25 20:14:17
> #include <stdio.h>
> long long   n,num[1000001],t[10];
> 
> int  main()
> {
>      long  long i,j;
>      while (scanf ("%I64d",&n)!=EOF)
>      {
>            num[1]=1;
>            num[2]=2;
>            for (i=3;i<=n;i++)
>            {
>                if (i%2==1)    num[i]=num[i-1];
>                if (i%2==0)    num[i]=num[i-2]+num[i/2];  //dp的思想 
////////////////////////////////上面加法溢出!!!!!!!!!!!!!!
>            }
>            for (i=0;i<9;i++)
>            {
>                t[i]=num[n]%10;
>                num[n]/=10;
>            }
>            for (i=8;i>=0;i--) 
>               if (t[i])
>                   printf ("%d",t[i]);
>            printf("\n");
>      }
>      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