Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main(){
- ios::sync_with_stdio(false);
- cin.tie(0);
- int t;
- cin>>t;
- vector<double>vec;
- vec.push_back(0);
- for(int x=1;x<=1000001;x++){
- vec.push_back(vec[x-1] + log10(x));
- }
- for(int i=0;i<t;i++){
- int a,b;
- cin>>a>>b;
- long long result = (vec[a]/log10(b))+1;
- cout<<"Case "<<i+1<<": "<<result<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement