Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- double f[1000010];
- int main()
- {
- int test,p;
- long i,n,b,c;
- scanf("%d",&test);
- for(i=1;i<=1000000;i++)
- f[i]=log(i)+f[i-1];
- for(p=1;p<=test;p++)
- {
- scanf("%ld%ld",&n,&b);
- c=f[n]/log(b)+1;
- printf("Case %d: %ld\n",p,c);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement