Hi

is there any way to speed up my program

The first smallest number who's factorial is bigger or equal to the inputed number

first we input the number of test cases

ex.

3

1

101

2008

1

70

811

should i use some other data structure(tree or something) than dynamic array??

is there any way to speed up my program

**it needs to find:**The first smallest number who's factorial is bigger or equal to the inputed number

first we input the number of test cases

ex.

**input**3

1

101

2008

**output**1

70

811

should i use some other data structure(tree or something) than dynamic array??

Code:

#include <math.h> #include <stdio.h> #include <stdlib.h> int main() { int i=0,br,t=0,br_cif; int *a= (int*)malloc(sizeof(int)*205019); scanf("%d",&t); float dig=0.0; //for log10 for (i = 1; i <=205019; i++) { dig +=log10(i); a[i]=(int)floor(dig)+1; //aproximation } while(t--){ scanf("%d", &br); i=1; //we search for the first number while(1){ if(a[i]>=br) {printf("%d\n",i);break;} i++ ; } } return 0; }