Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- using namespace std;
- int main(){
- int t;
- cin>>t;
- for(int k=0;k<t;k++){
- long long a,b;
- cin>>a>>b;
- int j=1;
- while(b - (pow(a,j) * j) >= 0){
- b-=pow(a,j)*j;
- j++;
- }
- long long h = b / j;
- long long j1 = j;
- long long thesi;
- thesi = h;
- char s[j1];
- for(int i=0;i<j1;i++){
- s[i] = 'a';
- }
- b = b % j1;
- int x = j1 - b;
- x--;
- char c = 'a';
- x = thesi / pow(a,x);
- x = x % a;
- c+=x;
- cout<<c<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement