1 solutions

  • 0
    @ 2025-3-3 16:33:14

    C++ :

    #include<bits/stdc++.h> 
    using namespace std;
    
    stack<int> st;//stl栈;
    int n, in = 1;
    int main(){
       cin>>n;
        while (n--){
             int x;  cin>>x;
             if (in > x) st.pop();
             else
                 while(in<=x)
                 {
                     st.push(in);
                     putchar('A');
                     in++;
                 }
             putchar('B');
        }
       putchar('\n');
        return 0;
    }
    
    
    
    • 1

    Information

    ID
    10534
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By