sukarnapaul

Untitled

Apr 19th, 2018
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5.  
  6.  
  7. int main(){
  8. ios::sync_with_stdio(false);
  9. cin.tie(0);
  10. int t;
  11. cin>>t;
  12. vector<double>vec;
  13. vec.push_back(0);
  14. for(int x=1;x<=1000001;x++){
  15. vec.push_back(vec[x-1] + log10(x));
  16. }
  17. for(int i=0;i<t;i++){
  18. int a,b;
  19. cin>>a>>b;
  20.  
  21.  
  22. long long result = (vec[a]/log10(b))+1;
  23. cout<<"Case "<<i+1<<": "<<result<<"\n";
  24. }
  25.  
  26. }
Add Comment
Please, Sign In to add comment