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

谁能给个Limit的下限和证明?

Posted by zhangxiao1124 at 2008-05-20 21:18:54 on Problem 1252
#include<iostream>
using namespace std;
#define maxn 100000
#define inf 100000000
#define limit 20000                     //就是这个东西
int f[maxn],a[10];

int main() {
    int test;
    for (scanf("%d",&test); test; test--) {
        for (int i=0; i<6; i++) scanf("%d",a+i);
        fill_n(f,maxn,inf);
        f[0]=0;
        for (int i=1; i<=limit; i++)
            for (int j=0; j<6; j++) if (i>=a[j]) f[i]<?=f[i-a[j]]+1;
        for (int i=limit; i>=1; i--)
            for (int j=0; j<6; j++) f[i]<?=f[i+a[j]]+1;
        double ans=0,maxd=0;
        for (int i=1; i<=100; i++) ans+=f[i],maxd>?=f[i];
        printf("%.2lf %.0lf\n",ans/100.0,maxd);
    }
    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