#include<bits/stdc++.h>
using namespace std;
double arr[1000005];
int main()
{
long long T,n,b,c=1,i;
arr[0]=0.0;arr[1]=0.0;
for(i=2;i<=1000005;i++)
arr[i] = log(i)+arr[i-1];
// freopen("check.txt","r",stdin);
scanf("%lld",&T);
while(T--)
{
scanf("%lld%lld",&n,&b);
printf("Case %lld: %lld\n",c++,(long long)((arr[n]/log(b)+1)));
}
return 0;
}
Thursday, July 30, 2015
1045 - Digits of Factorial
Subscribe to:
Post Comments (Atom)
Triathlon
Triathlon - CodeChef # include < bits/stdc++.h > using namespace std ; # define fi first # define se second # define mp ...
-
# include < bits/stdc++.h > using namespace std ; int main ( ) { int T , c = 1 ; double r1 , r2 , h , p ; // ...
-
# include < bits/stdc++.h > using namespace std ; int main ( ) { long long T , S , l , n , c = 1 ; // freopen(&qu...
-
# include < bits/stdc++.h > using namespace std ; int main ( ) { int T , n , p , q , c = 1 , i , w , t , arry [ 50 ] ; ...
No comments:
Post a Comment