Ask for help with 70 points problem
查看原帖
Ask for help with 70 points problem
1123368
fastor2023楼主2023/10/20 19:28
#include <bits/stdc++.h>
using namespace std;
const int N=3000005;
bool a[N];
int main() {
	//freopen("revflip4.in","r",stdin);
	int n;
	cin>>n;
	for(int i=1; i<=n; i++)
		cin>>a[i];
	if(n%2){
		for(int i=1; i<=n; i+=2)
			cout<<!a[i]<<' ';
		for(int i=2; i<n; i+=2)
			cout<<a[i]<<' ';
	}else {
		for(int i=n; i>=2; i-=2)
			cout<<!a[i]<<' ';
		for(int i=1; i<n; i+=2)
			cout<<a[i]<<' ';
	}
	return 0;
}
2023/10/20 19:28
加载中...