竞赛讨论区 > 这格式问题是真害人呀,我搞不懂,有大佬会吗
头像
bb来来来
发布于 2023-04-02 21:01
+ 关注

这格式问题是真害人呀,我搞不懂,有大佬会吗

#include <cstdio>

#include <cctype>

#include <cstring>

#include <cmath>

#include <cstdlib>

#include<iostream>

#include<bits/stdc++.h>

using namespace std;

int main() {

// freopen("a.in", "r", stdin);

// freopen("a.out", "w", stdout);

int n;

while(cin>>n){

queue<int>a;

for(int i=1;i<=n;i++){

int k;

cin>>k;

a.push(k);

}

int po;

cin>>po;

int flag=0;

for(int i=1;i<=n;i++){

int k=a.front();

a.pop();

if(k!=po||(k==po&&flag==1)){

a.push(k);

} else{

flag=1;

}

}

while(!a.empty()){

int k=a.front();

a.pop();

if(a.size()==0){

cout<<k;

}else{

cout<<k<<" ";

}

}

}

return 0;

}

全部评论

(0) 回帖
加载中...
话题 回帖

本文相关内容

等你来战

查看全部

热门推荐