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 vook at 2017-03-23 12:58:25 on Problem 2229
#include <iostream>
#include <cstdio>
#include <cstring>
#define mod 1000000000
using namespace std;
int d[1000005];
int main()
{
    memset(d,0,sizeof(d));
    d[1]=1;
    d[2]=2;
    int n;
    scanf("%d",&n);
    for(int i=3;i<=n;i++)
    {
        d[i]=d[i-1];
        i++;
        d[i]=(d[i-1]%mod+d[i/2]%mod)%mod;
    }
    printf("%d\n",d[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