| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
谁能给个Limit的下限和证明?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator