1 solutions

  • 1
    @ 2026-4-4 8:33:23
    #include<bits/stdc++.h>
    using namespace std;
    queue<int>q;
    vector<int>c;
    int main()
    {
    	int n;
    	cin>>n;
    	for(int i=0;i<n;i++)
    	{
    		int a;
    		cin>>a;
    		q.push(a);
    	}
    	int x=0;
    	while(!q.empty())
    	{
    		x++;
    		if(x%2==1)
    		{
    			cout<<q.front()<<" ";
    			q.pop();
    		}
    		else if(x%2==0)
    		{
    			q.push(q.front());
    			q.pop();
    		}
    	}
    	return 0;
    }
    

    Information

    ID
    1869
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    6
    Tags
    # Submissions
    25
    Accepted
    10
    Uploaded By