Advertisement
theo830

infinity

May 23rd, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4. int main(){
  5. int t;
  6. cin>>t;
  7. for(int k=0;k<t;k++){
  8. long long a,b;
  9. cin>>a>>b;
  10. int j=1;
  11. while(b - (pow(a,j) * j) >= 0){
  12. b-=pow(a,j)*j;
  13. j++;
  14. }
  15. long long h = b / j;
  16. long long j1 = j;
  17. long long thesi;
  18. thesi = h;
  19. char s[j1];
  20. for(int i=0;i<j1;i++){
  21. s[i] = 'a';
  22. }
  23. b = b % j1;
  24. int x = j1 - b;
  25. x--;
  26. char c = 'a';
  27. x = thesi / pow(a,x);
  28. x = x % a;
  29. c+=x;
  30. cout<<c<<endl;
  31. }
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement