fork(1) download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.tie(0);
  8.  
  9. int t;
  10. cin >> t;
  11. while (t--)
  12. {
  13. int n, k; cin >> n >> k;
  14. string f0 = "a" ,f1 = "b", fn;
  15. for (int i = 2; i <= n; i++)
  16. {
  17. fn = f0 + f1;
  18. f0 = f1;
  19. f1 = fn;
  20. }
  21. cout << f1[k - 1] << endl;
  22. }
  23. }
Success #stdin #stdout 0s 5320KB
stdin
4
0 1
1 1
3 2
7 7
stdout
b
b
a
a