hdu 2832 (Snail’s trouble)
#include<stdio.h> #include<math.h> const double esp=1.0e-10; double a[400]; int main() { int k; int i; a[0]=0; for(i=1;i<400;i++) a[i]=a[i-1]+1.0/i; int b[11]={441,710,1230,2336,4983,12367,37568,150661, 898515,9717617,272400600}; while(scanf("%d",&k)!=EOF) //for(k=5;k<101;k++) { if(k>15) { for(i=0;i<400;i++)//400 if(k*a[i]/100>=1-esp)break; } else i=b[15-k]; printf("%d\n",i); } return 0; }
@@注意浮点型的精度