Advertisement
erfanul007

LOJ 1045

Apr 14th, 2021
691
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. double f[1000010];
  4. int main()
  5. {
  6.     int test,p;
  7.     long i,n,b,c;
  8.     scanf("%d",&test);
  9.     for(i=1;i<=1000000;i++)
  10.         f[i]=log(i)+f[i-1];
  11.     for(p=1;p<=test;p++)
  12.     {
  13.         scanf("%ld%ld",&n,&b);
  14.         c=f[n]/log(b)+1;
  15.         printf("Case %d: %ld\n",p,c);
  16.     }
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement