Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- string fun(int n){
- queue<string>q;
- q.push("1");
- q.push("2");
- while(n>1){
- q.push(q.front()+"1");
- q.push(q.front()+"2");
- q.pop();
- n--;
- }
- return q.front();
- }
- int main() {
- //code
- int t;
- cin>>t;
- while(t!=0){
- int n;
- cin>>n;
- cout<<fun(n)<<endl;
- t--;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement