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 chubuxiao2015 at 2016-05-04 07:49:35 on Problem 3181
In Reply To:2WA+6TLE+1CE=1AC Posted by:wolf711988 at 2009-03-22 16:36:53
#include<stdio.h>
#include<algorithm>
using namespace std;
int n,m,i,j;
int f[1005][100];
void plus1(int x,int y){
    int c=0,k=max(f[x][0],f[y][0]);
    for(int i=1;i<=k;i++){
        f[x][i]=f[x][i]+f[y][i]+c;
        c=f[x][i]/10;
        f[x][i]%=10;
    }f[x][0]=k;
    while(c){
        f[x][++f[x][0]]=c%10;
        c/=10;
    }return;
}
int main()
{
    scanf("%d %d",&n,&m);
    f[0][0]=1;f[0][1]=1;
    for(i=1;i<=m;i++)
        for(j=i;j<=n;j++)
            plus1(j,j-i);
    for(i=f[n][0];i;i--)
        printf("%d",f[n][i]);
    return 0;
}
583B就AC了

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