Daffodil International University
Problem Link
//Please Follow from main function
#include<bits/stdc++.h>
using namespace std;
/// Typedef
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector< pii > vii;
#define pb push_back
#define ppb pop_back
#define MP make_pair
#define ff first
#define ss second
#define sf scanf
#define pf printf
#define SQR(x) ((x)*(x))
#define loop(i, y) for(int i=0; i<int(y); i++)
#define FOR(i, x, y) for(int i=int(x); i<=int(y); i++)
#define ROF(i, x, y) for(int i=int(x); i>=int(y); i--)
#define ALL(c) c.begin(), c.end()
#define SZ(c) int(c.size())
#define CLR(x, y) memset(x, y, sizeof(x))
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define FastIO ios_base::sync_with_stdio(false)
#define tr(it, container) for(auto it = container.begin(); it != container.end(); it++)
#define sci(x) scanf("%d", &x)
#define scii(x, y) scanf("%d %d", &x, &y)
#define sciii(x, y, z) scanf("%d %d %d", &x, &y, &z)
#define scl(x) scanf("%lld", &x)
#define scll(x, y) scanf("%lld %lld", &x, &y)
#define sclll(x, y, z) scanf("%lld %lld %lld", &x, &y, &z)
#define bitCheck(N,in) ((bool)(N&(1<<(in))))
#define bitOff(N,in) (N&(~(1LL<<(in))))
#define bitOn(N,in) (N|(1LL<<(in)))
#define bitFlip(a,k) (a^(1LL<<(k)))
#define unq(v) sort(all(v)), (v).erase(unique(all(v)),v.end())
#define common(a,b) sort(all(a)), sort(all(b)), a.erase(set_intersection(all(a),all(b),a.begin()),a.end())
#define uncommon(a,b) sort(all(a)), sort(all(b)), a.erase(set_symmetric_difference(all(a),all(b),a.begin()),a.end())
#define dbg(x) cout<<#x<<" = "<<x<<endl;
double logg[1000005];
void calculatedigit(){
for(int i=1;i<=1000000;i++)
logg[i]=logg[i-1] + log(i);
}
int main()
{
int t, n, b;
calculatedigit();
sci(t);
for(int cas=1;cas<=t;cas++)
{
scii(n, b);
long long cnt=logg[n]/log(b) + 1;
cout<<"Case "<<cas<<": "<<cnt<<endl;
}
return 0;
}
0 Comments